note 105639 added to function.mt-rand
| From: | j dot s dot shiuan at gmail dot com | Date: | Fri, 02 Sep 2011 18:12:52 +0000 |
| Subject: | note 105639 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182911@lists.php.net to get a copy of this message | ||
Another good way to get a random float is to divide the result of mt_rand.
Let's say we want a float between 0.75 and 1.25.
<?php
$i = mt_rand(75,125) / 100;
?>
----
Server IP: 80.81.171.181
Probable Submitter: 91.153.186.145
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/105639
Del: integrated -- https://master.php.net/note/delete/105639/integrated
Del: useless -- https://master.php.net/note/delete/105639/useless
Del: bad code -- https://master.php.net/note/delete/105639/bad+code
Del: spam -- https://master.php.net/note/delete/105639/spam
Del: non-english -- https://master.php.net/note/delete/105639/non-english
Del: in docs -- https://master.php.net/note/delete/105639/in+docs
Del: other reasons-- https://master.php.net/note/delete/105639
Reject -- https://master.php.net/note/reject/105639
Search -- https://master.php.net/manage/user-notes.php