note 26865 added to function.shuffle
| From: | drmccolgan at aol dot com | Date: | Fri, 15 Nov 2002 08:18:35 +0000 |
| Subject: | note 26865 added to function.shuffle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39526@lists.php.net to get a copy of this message | ||
Yet another array shuffle routine.
===============================
function swapshuffle($array) {
srand ((double) microtime() * 10000000);
for ($i=0;$i<sizeof($array);$i++) {
$from=rand(0,sizeof($array)-1);
$old=$array[$i];
$array[$i]=$array[$from];
$array[$from]=$old;
}
return $array;
}
================================
--
http://www.php.net/manual/en/function.shuffle.php
http://master.php.net/manage/user-notes.php?action=edit+26865
http://master.php.net/manage/user-notes.php?action=delete+26865
http://master.php.net/manage/user-notes.php?action=reject+26865