Ok, so i have a php random number generator that creates two unique numbers between 1 and 10, what i want to add that i can't figure out for the life of me is how to implement that these two numbers will always have a separation of 4. For example, 1 and 6...or even 2 and 9.... but never 2 and 3... or 4 and 7.
<?php
$arr=array();
while(count($ar r)<2){
$x=mt_rand(1,10 );
if (!in_array($x,$ arr)){
$arr[]=$x;
echo "$x<br>";
}
}
?>
Thanks in advance.
<?php
$arr=array();
while(count($ar r)<2){
$x=mt_rand(1,10 );
if (!in_array($x,$ arr)){
$arr[]=$x;
echo "$x<br>";
}
}
?>
Thanks in advance.
Comment