[..] >>> is there any way to limit to 4 in each group without 47839 rows of >>> code? [..] >> yes. you can. ;) [..] > oh, thank you very much :P [..]
This might be a bit more helpful ;) There are several way to do it, this is just one. Unoptimised, aimed at readability. <?php // Split $items equally among $items function randGroup($items, $groups) { // Init $return = array(); $cnt = 0; // Shuffle srand ((float)microtime()*1000000); shuffle ($items); // Divide up while (sizeof($items)) { $return[$cnt++] = array_pop($items); if ($cnt >= $groups) $cnt = 0; } // Return return $return; } // Replace these with the items you want, and specifiy 4 groups $items = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14); $result = randGroup($items, 4); echo "<pre>"; print_r($result); echo "</pre>"; ?> -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software & Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php