for($j=1;$j<=3;$j++)
{
$rand0=rand(1,$num*2+$j);
$temp=$genes[$i][$rand0];
$genes[$i][$rand0]=0;
for($k=$rand0+1;$k<=$num*2+$j;$k++)
{
$temp1=$genes[$i][$k];
$genes[$i][$k]=$temp;
$temp=$temp1;
}
}
$num=4
小弟要在阵列中随机插入3个0
插入0后其他数值往后移一格
echo出来阵列中的值都对
只是上面会显示一堆
Notice: Undefined offset: 9 in C:\xampp\htdocs\thesis\algorithm.php on line
147
Notice: Undefined offset: 10 in C:\xampp\htdocs\thesis\algorithm.php on line
147
Notice: Undefined offset: 11 in C:\xampp\htdocs\thesis\algorithm.php on line
147
请问各位这要怎么解决阿QQ