php random script running slowly
here seems to be the problem
<?php
function sortear($prevItems, $number) {
for ($k=0; $k<sizeof($prevItems); $k++) {
if ($prevItems[$k] == $number)
return true;
}
return false;
}
for ($i=0; $i<=9; $i++) {
$num[$i] = rand($_GET['inicial'],$_GET['final']);
while (sortear($prevItems, $num[$i])) {
$num[$i] = rand($_GET['inicial'],$_GET['final']);
}
$prevItems[$i] = $num[$i];
}
sort($num);
?>
any sugestion for this random? rest of code here
Aucun commentaire:
Enregistrer un commentaire