Copyright © 2006 Andrew B. Davidson. All Rights Reserved.
Last Updated: November 2006
Is there a corresponding mt_seed() function for mt_rand()?
Yes. However, you are probably thinking of the wrong name.
The name of the function you are after is
mt_srand.
It is defined as follows:
void mt_srand ( [int seed] )
Seeds the random number
generator with seed.
Since PHP 4.2.0, the seed becomes
optional and defaults to a random
value if omitted.
The mt_srand() function is available in PHP 3.0.6 or higher, PHP 4, and PHP 5, so you should have no
trouble using this random seed function in your PHP scripts.
I hope this information helps the
PHP development
efforts for your web sites and scripts!
Comments?
If you have an comments or suggestions on this technique, you can email me
at AndrewDavidson {at} AndrewDavidson {dot} com, or use my
Feedback Form
if you prefer.