RE: [PHP] seeding using mt_srand();
| From: | Phil Schwarzmann | Date: | Wed, 16 Oct 2002 12:46:40 +0000 |
| Subject: | RE: [PHP] seeding using mt_srand(); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120181@lists.php.net to get a copy of this message | ||
So I need to call it each time the page gets reloaded I guess....
I can't just have the user load a file called generate.php which has the
mt_srand....and then keep calling random.php (which has mt_rand) without
calling generate.php right?
-----Original Message-----
From: Jon Haworth [mailto:jhaworth@witanjardine.co.uk]
Sent: Wednesday, October 16, 2002 3:40 PM
To: 'Phil Schwarzmann'; php-general@lists.php.net
Subject: RE: [PHP] seeding using mt_srand();
Hi Phil,
> How often do you need to call mt_srand(); ?
As of version 4.2.0 you don't have to call it at all. If your PHP
installation is an earlier version than that, call it once per script,
before generating any random numbers, e.g:
mt_srand($seed);
$randomA = mt_rand();
$randomB = mt_rand();
$randomC = mt_rand();
> Just once? Or each time the page gets reloaded?
Uh... same thing, surely?
Cheers
Jon