|
|
 |
|
Title:
Random Password Generator By Rohit D'souza
Submitter: rohit d'souza
(other recipes)
Last Updated: 2006/06/23
Version no: 1.1
Category:
Numbers
|
|
|
Description:
Its help to generate Unique 10 character password on every reload of the page
Usage: Text Source
@myarray=(A,B,C,1,2,3,4,5,6,7);
for($i=0;$i<$#myarray;$i++)
{
$j=rand(10);
$randomnum.=$myarray[$j];
}
print $randomnum;
The license for this recipe is available here.
Discussion:
|
|
Add comment
|
|
Number of comments: 4
Minor correction, Satyam Sinha, 2006/05/30
Hi,
The array should be defined with an @myarray instead of $myarray. $# will not really work as expected.
Seems like a typo.
Add comment
Minor correction, Satyam Sinha, 2006/05/30
Hi,
The array should be defined with an @myarray instead of $myarray. $# will not really work as expected.
Seems like a typo.
Add comment
Minor correction, Satyam Sinha, 2006/05/30
Hi,
The array should be defined with an @myarray instead of $myarray. $# will not really work as expected.
Seems like a typo.
Add comment
Works but ..., ebo cmoa, 2008/04/17
i think it's better to use this kind of code :
sub generate_password {
my $password;
my @chr_chars = (
33..47, 58..64, 91..96, 123..126, # Punctuation
48..57, # Numbers
65..90, # Capital letters
97..122 # Small letters
);
$password .= chr($chr_chars[int(rand(scalar @chr_chars))]) for (0..10);
return $password;
}
Add comment
|
|
|
|
|
 |
|