On Monday 12 January 2004 12:30, Jon wrote:
> I am running the latest stable PHP release.

Which is? "Latest" changes over time. Always state the exact version. 

>  I am passed values and my
> range is far less than the max...  On my computer with my Xitami webserver
> this code returns the number 45 over and over:
>
> $num = rand(0,50);
> echo $num;
>
> I don't know what to do.  The rand function worked a few times then died on
> me.  I dunno if this is a bug or if I am just bad luck. Never had a problem
> before.  It seems that on a different computer it returns a different
> number than 45 but always the same number over and over.

If you are using a relatively new version of PHP then there is no need to seed 
the random number generator. And it is better to use mt_rand() rather than 
rand() because:

- it is supposed to produce better random numbers
- is faster than rand()


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
No evil can happen to a good man.
                -- Plato
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to