Sup,
I made this and have been using it for about 6 months without problem.
mt_rand() is 4 times faster than normal rand(), remember to use mt_srand()
to seed. The 8 in the while controls how long the $password will be...
$count = 0;
mt_srand( (double) microtime() * 1000000);
while( $count < 8 )
{
$randval = mt_rand(48 , 122);
$timeout++;
// currently allows 0-9 and a-z (lowercase), add 65-90 for uppercase
if(($randval > 47 && $randval < 58) || ($randval > 96 && $randval < 123))
{
$password .= chr($randval);
$count++;
}
}
SL.
----- Original Message -----
From: "Randy Johnson" <[EMAIL PROTECTED]>
Cc: "Php-General" <[EMAIL PROTECTED]>
Sent: Tuesday, April 24, 2001 12:10 AM
Subject: [PHP] random letters and numbers
> Is there a way to generate a random set of characters ranging from 8 to 12
> characters and numbers where it is crucial that the letters and numbers
are
> truly random because I need to create temporary files for people to
download
> information.
>
> Any links/suggestions would be greatly appreciated
>
> Thanks
>
> Randy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]