>     srand();
> 
>     As of the CVS version of PHP, if you leave the seed out, the rand
>     implementation will autogenerate it for you (it really wasn't that
>     hard beforehand, but...)
> 
>     I'm currently debating whether seeding at startup is a good idea,
>     because alot of scripts don't use rand() (alot do I know, but
>     still), and seeding at startup will cause a slow down in PHP...
>     another thought is to have rand() check whether or not its been
>     seeded, and if it has been seeded, use the previous seed,
>     otherwise, seed the generator (I'm currently leaning towards the
>     latter).

Having a state flag around rand() and srand() which indicates, upon a call
to rand, whether or not srand() has been called is a great idea. When PHP is
acting as part of a web page, seeding the random number generator is a
fairly tricky thing to maintain.

If you don't do it in the module, a user would have to do it in the PHP
environment, and that is a little more difficult.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to