note 63788 added to function.shuffle

From: Date: Thu, 30 Mar 2006 20:57:13 +0000
Subject: note 63788 added to function.shuffle
Groups: php.notes 
Request: Send a blank email to php-notes+get-107049@lists.php.net to get a copy of this message
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) ---- Server IP: 147.32.160.17 Probable Submitter: 85.70.112.71 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.shuffle.php Edit -- http://master.php.net/note/edit/63788 Del: integrated -- http://master.php.net/note/delete/63788/integrated Del: useless -- http://master.php.net/note/delete/63788/useless Del: bad code -- http://master.php.net/note/delete/63788/bad+code Del: spam -- http://master.php.net/note/delete/63788/spam Del: non-english -- http://master.php.net/note/delete/63788/non-english Del: in docs -- http://master.php.net/note/delete/63788/in+docs Del: other reasons-- http://master.php.net/note/delete/63788 Reject -- http://master.php.net/note/reject/63788 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107049) next »