note 35434 added to function.rand
| From: | tsoyalexii at mail dot ru | Date: | Mon, 01 Sep 2003 08:34:52 +0000 |
| Subject: | note 35434 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55394@lists.php.net to get a copy of this message | ||
there is some notice for this function:
if you use this:
$a = intval(rand(0,-5)); // wrong order of Max and Min values
value of $a will be in range [0;-3]
if you use this:
$b = intval(rand(-5,0)); // right order of Max and Min value
value of $b will be in range [0;-5]
Alex
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35434
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35434&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35434&report=yes