note 73237 deleted from function.mt-rand by salathe
| From: | salathe@php.net | Date: | Fri, 07 Nov 2014 11:02:47 +0000 |
| Subject: | note 73237 deleted from function.mt-rand by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200815@lists.php.net to get a copy of this message | ||
Note Submitter: heavyraptor
----
since my mt_rand_n() function isn't too fast I created a faster and easier function:
<?php
function mt_rand_exclusive($min,$max,$ex) {
while (true) {
if (!in_array($rand = mt_rand($min,$max),(array)$ex))
return $rand;
}
}
?>
Have fun