note 73237 added to function.mt-rand
| From: | heavyraptor at osu1 dot php dot net | Date: | Wed, 14 Feb 2007 11:26:10 +0000 |
| Subject: | note 73237 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123365@lists.php.net to get a copy of this message | ||
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
----
Server IP: 194.153.94.10
Probable Submitter: 86.118.124.111
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/73237
Del: integrated -- https://master.php.net/note/delete/73237/integrated
Del: useless -- https://master.php.net/note/delete/73237/useless
Del: bad code -- https://master.php.net/note/delete/73237/bad+code
Del: spam -- https://master.php.net/note/delete/73237/spam
Del: non-english -- https://master.php.net/note/delete/73237/non-english
Del: in docs -- https://master.php.net/note/delete/73237/in+docs
Del: other reasons-- https://master.php.net/note/delete/73237
Reject -- https://master.php.net/note/reject/73237
Search -- https://master.php.net/manage/user-notes.php