some help for a beginner
Posted: Sat Oct 09, 2010 5:41 am
Hi,
I am attempting to generate two sets of random numbers, and have them pair up with no conflitcs.
the end result would look something like this:
1 5
2 3
5 1
4 2
3 4
I have the first set of numbers created, but I can't seem to figure out how to generate a second set and match them as shown above.
<?php
$numbers = array("1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10 ", "11 ", "12 ");
shuffle($numbers);
foreach ($numbers as $number) {
echo "$number ";
echo "<br />";
}
?>
Any help would be appreciated.
Thanks
I am attempting to generate two sets of random numbers, and have them pair up with no conflitcs.
the end result would look something like this:
1 5
2 3
5 1
4 2
3 4
I have the first set of numbers created, but I can't seem to figure out how to generate a second set and match them as shown above.
<?php
$numbers = array("1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10 ", "11 ", "12 ");
shuffle($numbers);
foreach ($numbers as $number) {
echo "$number ";
echo "<br />";
}
?>
Any help would be appreciated.
Thanks