in reply to Quicky password sub
This might be faster because it doesn't have all of the checks for the range of acceptable chars. It precalculates the acceptable chars and stores them in an array in a closure so it only has to calculate and store once. You can adjust the chars that you want acceptable by changing the the assignment in the closure.
{ my @password_chars = ( 0..9,A..Z,a..z ); # acceptable chars sub Pass { my $password = ''; for ( 1..8 ) { $password .= $password_chars[rand(@password_chars)]; } return $password; } }
T.R. Fullhart, kayos@kayos.org
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Quicky password sub
by chromatic (Archbishop) on May 02, 2000 at 19:07 UTC | |
by turnstep (Parson) on May 02, 2000 at 22:42 UTC | |
by buzzcutbuddha (Chaplain) on May 02, 2000 at 21:31 UTC |