in reply to random passgen

I suspect that your problem is in the indexing - you've used rand(20) and rand(5) although there are 19 consonants and 6 vowels. Here's my version of your code:
print "gimme a seed: "; my $s = <STDIN>; my @chars = qw(b c d f g h j k l m n p r s t v w x z); my @vowels = qw(a e i o u y); my $length = 4; #Should be (length of password)/2 srand ($s ^ time); print $chars[int(rand(@chars))], $vowels[int(rand(@vowels))] while($le +ngth--);
update: Thanks to chipmunk and Aighearach change int(rand(length(@vowels))) to <int(rand(@vowels)) - As Aighearach says, "Yay! for context!" :) hth, bent

Replies are listed 'Best First'.
Re: Re: random passgen
by merlyn (Sage) on May 04, 2001 at 18:53 UTC
    The int's are redundant as well. The idiom for grabbing a random item of an array is just:
    my $one_char_at_random = $chars[rand @chars];
    No point in adding noise parens or noisy int functions.

    -- Randal L. Schwartz, Perl hacker