您的位置:首页 > Web前端 > JavaScript

Js随机数--网页版的体育彩票选号器

2016-06-20 10:35 288 查看
<script>

function Quickpick()
{
var ball
for( ball = 0; ball < 5; ball++)
{
this[ball] = parseInt((Math.random() * Math.pow(10,16)) % 49) + 1;
for(var list = 0; list < ball; list++)
{
if(this[list] == this[ball])
{
list = ball;
ball--;
}
}
}
this[ball] = parseInt((Math.random() * Math.pow(10,16)) % 42) + 1;
return this;
}

console.log(Quickpick());

var idx;
var powerball = new Array(6);
powerball = this.Quickpick();
document.write("<center>");
document.write("体育彩票选号器");
document.write("<hr width=400><font size=+2>");
for(idx = 0; idx < 5; idx++)
document.write(powerball[idx] + " - ")
document.write("</font><font color=#D00000 size=+2>" + powerball[idx] + "</font>");
document.write("</center>");
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: