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!
?
| 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 |
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 (Redball[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.
?
| 1 2 3 4 5 |
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.