Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- mt_rand not at all random?
- Kevin Lin
October 7, 2004, 6:20 am
rate this thread
The following script:
<?php echo mt_rand();?>
always outputs "1755202938" on my machine. I'm running PHP 4.2.3 under
According to the docs:
"As of PHP 4.2.0, there is no need to seed the random number generator with
srand() or mt_srand() as this is now done automatically."
So why the non-random behavior?
Re: mt_rand not at all random?
It might be a bug in your release. I've tested under 4.2.2 (Red Hat Linux)
and values are always different. Do you get random values if you do seed
It could also be that it doesn't work this way under Windows but docs do
not mention it :-?
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions