note 79968 deleted from function.rand by bjori
| From: | bjori@php.net | Date: | Fri, 21 Dec 2007 17:14:12 +0000 |
| Subject: | note 79968 deleted from function.rand by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133865@lists.php.net to get a copy of this message | ||
Note Submitter: rok dot kralj at gmail dot com
----
joebert, your function is terribly wrong.
example: random_float(100,101);
Your function has a 100-times bigger possiblility to return 100 than any other float between 100 and
101.
Correct:
<?php
function random_float ($min,$max) {
return $min+lcg_value()*($max-$min);
}
?>