note 39339 added to function.rand
| From: | geeksinceseven at yahoo dot com | Date: | Sun, 25 Jan 2004 14:12:09 +0000 |
| Subject: | note 39339 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64142@lists.php.net to get a copy of this message | ||
When using PHP 4.3.4 and IIS 5.1 I had to use srand() before rand() in order to get a different
random value on refresh. Otherwise the same value kept coming up.
function get_random() {
$randomnumber = srand();
$randomnumber = rand(1,92);
print $randomnumber;
}
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39339
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39339&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39339&report=yes
Search -- http://master.php.net/manage/user-notes.php