震惊!彩票的随机机制竟然是这样的...

<?php

$lanList = [];
$hongList = [];

for($i=1;$i<34;$i++){
  if($i<16){
    array_push($lanList,$i);
  }
  array_push($hongList, $i);
}

$res = [
  'red' => [],
  'blue' => []
];

for($i=0;$i<=6;$i++){
  if($i==0){
    $res['blue'] = array_slice($lanList, mt_rand( 0,count($lanList)-1) ,1);
  }
  $res['red'][] = array_splice($hongList, mt_rand( 0,count($hongList)-1),1)[0];

}
sort($res['red']);
echo 'red:'.implode(',',$res['red']).' blue:'.implode(',',$res['blue']).PHP_EOL;

?>

标签: none

添加新评论