in reply to Re: Random Password Generator
in thread Random Password Generator
Presuming you want 3 each of the lowercase, uppercase, and digits, you can simplify the code to:
The whole thing of $password = join "", $password, ... in the original post is definitely worth unlearning if nothing else. {grin}my @ranges = ([a..z]) x 3, ([A..Z]) x 3, ([0..9]) x 3; my $password; while (@ranges) { $range = splice @ranges, rand @ranges, 1; # random pick $password .= $range->[rand @$range]; # random pick from the range }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Random Password Generator
by cosimo (Hermit) on Jul 01, 2005 at 15:42 UTC | |
by adrianh (Chancellor) on Jul 02, 2005 at 00:24 UTC | |
Re^3: Random Password Generator
by satz (Initiate) on Jul 02, 2005 at 04:22 UTC | |
Re^3: Random Password Generator
by Anonymous Monk on Jul 03, 2005 at 19:05 UTC |