$random_numbers = range(1,100);
shuffle($random_numbers);
$numbers_chosen = array($random_numbers[0],$random_numbers[1],
$random_numbers[2],$random_numbers[3]);
print "before ";
print_r($random_numbers); // first four numbers chosen
$random_numbers = array_splice($random_numbers,4);
print "
after ";
print_r($random_numbers); // first four numbers chosen
print "
chosen ";
print_r($numbers_chosen); // first four num5 bers chosen
?>
Saturday, December 16, 2006
How to randomize, return and remove numbers from a pool using PHP
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment