note 85828 added to function.mt-rand
| From: | xphere81 at hotmail dot com | Date: | Fri, 19 Sep 2008 11:08:03 +0000 |
| Subject: | note 85828 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144542@lists.php.net to get a copy of this message | ||
@Jonathon
$id_list = range($min, $max);
shuffle($id_list);
This is a faster way to obtain a list of unique id's in a random order.
It's always better to use PHP predefined functions, isn't it? ;)
Also remember that calling mt_rand too many times can downgrade the performance of ANY algorithm.
----
Server IP: 80.64.47.13
Probable Submitter: 213.0.23.254
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/85828
Del: integrated -- https://master.php.net/note/delete/85828/integrated
Del: useless -- https://master.php.net/note/delete/85828/useless
Del: bad code -- https://master.php.net/note/delete/85828/bad+code
Del: spam -- https://master.php.net/note/delete/85828/spam
Del: non-english -- https://master.php.net/note/delete/85828/non-english
Del: in docs -- https://master.php.net/note/delete/85828/in+docs
Del: other reasons-- https://master.php.net/note/delete/85828
Reject -- https://master.php.net/note/reject/85828
Search -- https://master.php.net/manage/user-notes.php