List Info

Thread: note 63788 added to function.shuffle




note 63788 added to function.shuffle
user name
2006-03-30 20:57:13
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 -- htt
p://www.php.net/manual/en/function.shuffle.php
Edit        -- http://master.p
hp.net/note/edit/63788
Del: integrated  -- ht
tp://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://m
aster.php.net/note/delete/63788/spam
Del: non-english -- h
ttp://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://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 63788 deleted from function.shuffle by bjori
user name
2006-03-30 23:30:26
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)

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )