note 16504 added to function.srand
| From: | trobinson-a-t-gksystems-d-o-t-com at php2 dot chek dot com | Date: | Fri, 02 Nov 2001 07:26:58 +0000 |
| Subject: | note 16504 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20286@lists.php.net to get a copy of this message | ||
The need to seed.
You might run a script like this:
echo mt_rand(0,99999999);
a bunch of times, say by pressing Refresh in the browser, and get a different result each time. That
is dependent on your web server. If the same apache/mod-php process lives through several
invocations of the script, it won't reset the seed each time. But every php process will start
with the same seed. If php is invoked as an external cgi, seed will always be the same. So... always
seed!
--
http://www.php.net/manual/en/function.srand.php
http://master.php.net/manage/user-notes.php?action=edit+16504
http://master.php.net/manage/user-notes.php?action=delete+16504
http://master.php.net/manage/user-notes.php?action=reject+16504