RE: [PHP] Rand function
| From: | Jon Haworth | Date: | Tue, 22 Jan 2002 11:06:01 +0000 |
| Subject: | RE: [PHP] Rand function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81517@lists.php.net to get a copy of this message | ||
> Can anyone tell me why, when I run this
> $number = rand (1,12);
> The only number that ever appears is 5?
> Not really a random number...
You need to seed the random number generator first.
http://www.php.net/srand
HTH
Jon