note 14350 added to function.srand.php
| From: | vonStahl at NOPE2SPAM dot ratio dot net | Date: | Fri, 27 Jul 2001 09:32:13 +0000 |
| Subject: | note 14350 added to function.srand.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15933@lists.php.net to get a copy of this message | ||
How about<br>
<?
srand((double)microtime()*1000000);
$seed = rand(1000000,9999999);
srand((double)microtime()*$seed);
$yadda = rand (1,100);
?><br>
I used this in a test run with 1,000.000 calls for $yadda. Processing time increased by 0.0000061
seconds compared to a simple "srand((double)microtime()*1000000);"
$yadda had the value of each number between 1 and 100 for between 0.99999122% and 1.00000872% of all
calls. That's random and fast enough for me. :)
http://www.php.net/manual/en/function.srand.php