[PHP-DOC] HELP - function rand() From: Thales \(UOL\) (thalescm <email protected>)
Date: 06/22/02

    Hi, all!
        I'd like to know why the function rand() always returns the lowest number in my local server, and when I take it to my server on the WEB, it works perfectly. Every time I reload my page running my local server, this function returns the same result, and in my WEB server, it works. For exemple:

Running Apache in my computer (localhost):
echo rand(0,10); -- Always return 0.

Running Apache in my WEB server, in other machine:
echo rand(0,10); -- returns at first 4, then 2, then 9, then 7...

Other exemple:

Running Apache in my computer (localhost):
for ($x=0;$x<4;$x++) {echo rand(0,10);} -- ALWAYS returns 0 (the first is always the lowest number)275. Even if I reload it, this will be the same result (0, 2, 7 and 5). Just when I restart the webserver, it changes.

Running Apache in my WEB server, in other machine:
for ($x=0;$x<4;$x++) {echo rand(0,10);} -- At the first time: 8190. The second: 5513, and always different.

    If someone could explain me, please do that.
    Thanks!

Thales Medeiros.