note 21709 deleted from function.shuffle by nlopess

From: Date: Thu, 24 Jun 2004 16:19:34 +0000
Subject: note 21709 deleted from function.shuffle by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71604@lists.php.net to get a copy of this message
Note Submitter: office@rgits.com ---- Forget shuffle, this function will work well .... function ShuffleArray($array) // or &$array by reference { srand ((double) microtime() * 10000000); $caa=(count($array)-1); $new_array=$array; for ($x=0;$x<=$caa;$x++) { $ca=(count($array)-1); $i=rand(0,$ca); $new_array[$x]=$array[$i]; for ($t=$i;$t<$ca;$t++) $array[$t]=$array[$t+1]; array_pop($array); } return $new_array; by reference not needed }

« previous php.notes (#71604) next »