mt_rand doesn't seem random enough
| From: | Phil Schwarzmann | Date: | Mon, 14 Oct 2002 14:31:41 +0000 |
| Subject: | mt_rand doesn't seem random enough | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-119899@lists.php.net to get a copy of this message | ||
Maybe I'm wrong on this but mt_rand doesn't seem to be random enough.
I'm on a PHP 4.04 server and here's my code..
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed());
$randval = mt_rand();
I pulled this directly from php.net and am using it in my script.
Am I doing anything wrong here? It's "sorta" random but I can't believe
it's totally random.
Your thoughts.?