I do not deceive you said, I am also a shuangse qiu enthusiasts, often buy, but the delay has not been the first prize, haha.
Here for you to introduce a random generation of PHP lottery Shuangse Qiu number two ways for friends to learn the reference. In the new year, I wish you all a big prize and a great fortune.
Method One
Copy Code code as follows:
<?php
/*
Randomly generated lottery Shuangse qiu number
*/
$red = Array (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,29,30,31,32,33);
$blue = Array (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
For ($i =0 $i <6; $i + +) {
$index = rand (0,32-$i);
$redBall []= $red [$index];
Unset ($red [$index]);
for ($k = $index; $k <count ($red)-1; $k + +) {
$red [$k]= $red [$k +1];
}
}
Asort ($redBall);
?>
<div style= "Background-color:red;color:white;width:160px;float:left;text-align:center;" >
<?php
foreach ($redBall as $v) {
echo $v. " ";
}
?>
</div>
<div style= "Background-color:blue;color:white;width:40px;float:left;text-align:center" >
<?php
echo $blue [rand (0,15)];
?>
</div>
Method Two
Copy Code code as follows:
<?php
/*
Randomly generated lottery Shuangse qiu number
*/
echo "<br>";
echo "<p>";
$red 1=range (1,33);
$blue 1=mt_rand (1,6);
$SC 1=array_rand ($red 1,6);
?>
<div style= "Background-color:red;color:white;width:160px;float:left;text-align:center;" >
<?php
foreach ($sc 1 as $v) {
echo "$v";
}
?>
</div>
<div style= "Background-color:blue;color:white;width:40px;float:left;text-align:center" >
<?php
echo "$blue 1";
?>
</div>
The previous method is relatively troublesome, the need for friends, may wish to refer to the second method.