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
In reply to RE: Quicky password sub
by kayos
in thread Quicky password sub
by halxd2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |