0
我試圖生成異常獨特的隨機排列, 我走到這一步:PHP獨特的隨機數字陣列例外
function rand_except($min, $max,$no_numbers, $except) {
//loop until you get a unique randomized array without except number
$end=false;
while (!$end){
$numbers = rand_array($min, $max,$no_numbers);//get unique randomized array
if(!in_array($except,$numbers)){
$end=true;
break;
}
}
return $numbers;
}
,但現在我想要的功能循環,直到除了參數ISN」 t時的陣列
將函數添加到* rand \ _array *函數而不是一遍又一遍地調用它直到它產生所需的輸出爲止效率更高嗎? –