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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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;
?>
这个博客有个赞赏功能,不试一下吗?