note 26145 added to function.rand
| From: | cccc_nl at hotmail dot com | Date: | Sat, 19 Oct 2002 18:40:04 +0000 |
| Subject: | note 26145 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38304@lists.php.net to get a copy of this message | ||
rand() seems to return only integers, since I used rand(0.8, 1.2) * $a_variable; and the result was
0.
In case you are having the same problem, the simple solution is this:
// Create a number between 0.85 and 1.12
$r = (rand(85, 112) / 100);
--
http://www.php.net/manual/en/function.rand.php
http://master.php.net/manage/user-notes.php?action=edit+26145
http://master.php.net/manage/user-notes.php?action=delete+26145
http://master.php.net/manage/user-notes.php?action=reject+26145