The Shuangse Qiu number of the welfare lottery is made up of 6 red ball numbers and a basketball number, of which 6 red ball numbers are randomly drawn from 01 to 33 6 digits, and 1 basketball numbers are randomly drawn from 01 to 16. 6 red ball numbers are usually arranged in a small to large order. The following is a way to generate a note shuangse Qiu number in JavaScript for your reference!
var redball = new Array ();
var redlen = redball.length;
while (redlen<6) {
var ball = Rannumber (1,33);
var flag = true; for
(Var j=0;j<redlen;j++) {
if (red Ball[j]==ball) {
flag = false;
break;
}
if (flag) {
if (ball<10) {
Redball.push ("0″+ball);
} else{
redball.push (ball);
}
redlen = redball.length;
}
Redball.sort ();
var BlueBall = Rannumber (1,16);
if (blueball<10) {
BlueBall = "0″+blueball;
}
Alert (Redball.join (', ') + "|" + BlueBall);
Here is the Rannumber method, which returns a random integer between S and E.
function Rannumber (s,e) {
var staval = parsefloat (s);
var endval = parsefloat (e); return
Math.floor (Math . Random () * (Endval-staval) +staval);
The above mentioned is the entire content of this article, I hope you can enjoy.