note 63788 deleted from function.shuffle by bjori

From: Date: Thu, 30 Mar 2006 23:30:26 +0000
Subject: note 63788 deleted from function.shuffle by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107056@lists.php.net to get a copy of this message
Note Submitter: sKopheK ---- i dont know what to think about this: let say we have an array with 128 values, 78 of the are non-zero, others zeros... i want to randomly shuffle array so there will be one zero at most in one couple of values (i take two values at the same time, then next two). do { $blank = 0; shuffle($player); for ($i = 0; $i < sizeof($player); $i += 2) { if (!$player[$i] && !$player[$i + 1]) { $blank++; break; } } } while ($blank); is there anything wrong, i dont know, plz HELP! (doesnt work no matter if i use srand before or not)

« previous php.notes (#107056) next »