note 15032 added to function.srand.php
| From: | (fka richard@zend.com) | Date: | Sat, 25 Aug 2001 02:58:52 +0000 |
| Subject: | note 15032 added to function.srand.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17105@lists.php.net to get a copy of this message | ||
Here is a way to be sure you only call srand once:
function my_srand($seed = ''){
static $wascalled = TRUE;
if (!$wascalled){
$seed = $seed === '' ? (double) microtime() * 1000000 : $seed;
srand($seed);
}
}
http://www.php.net/manual/en/function.srand.php