I have a requirement where I am randomely creating numbers from an array for a game, I have a for loop which goes around for 10 times and generates random number and summing it up. I am not sure whether this is a good solution or not, can anyone suggest me some changes if required?
$target = array(1,rand(1,5));
for ($i = 0; $i < 10; $i++)
{
$target = array_merge( $target, array(rand($i,5),rand(1,$i)) );
}
echo '<pre>';
print_r($target);