As shown below:
Copy code The code is as follows:
/**
* Simple shuffling algorithm
* /
$card_num=54; //Number of cards
print_r(wash_card($card_num));
function wash_card($card_num)
{
$cards= $tmp=array();
for($i=0;$i<$card_num;$i++){
$tmp[$i]=$i;
}
for($i=0;$i<$card_num;$i++){
$index=rand(0,$card_num-$i-1); index];
unset($tmp[$index]);
$tmp=array_values($tmp);
}
return $cards;
}
?>
http://www.bkjia.com/PHPjc/327706.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327706.htmlTechArticle is as follows: Copy the code as follows: ?php /*** Simple shuffling algorithm*/ $card_num=54; //Number of cards print_r(wash_card($card_num)); function wash_card($card_num) { $cards=$tmp=array()...