PHP 4.0 Bug #9823: srand() -- seed should default to (double)microtime()*1000000
| From: | ryland at ryland dot net | Date: | Sun, 18 Mar 2001 21:25:03 +0000 |
| Subject: | PHP 4.0 Bug #9823: srand() -- seed should default to (double)microtime()*1000000 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49300@lists.php.net to get a copy of this message | ||
From: ryland@ryland.net
Operating system: all
PHP version: 4.0.4pl1
PHP Bug Type: Feature/Change Request
Bug description: srand() -- seed should default to (double)microtime()*1000000
In the user notes for srand(), richard@zend.com said:
>*ALWAYS* use (double)microtime()*1000000 as your seed.
>Do *NOT* just use time(). Do not add an extra 0 to make it "bigger".
...
>Anything else is sub-standard.
If so, why not make the seed argument optional, and make the default
(double)microtime()*1000000 when the argument is absent? Save me a
few keystrokes, anyway, and help make sure people don't do it in a
"sub-standard" fashion... :)
--
Edit Bug report at: http://bugs.php.net/?id=9823&edit=1