抽奖系统 random()

random() 方法可返回介于 0 ~ 1 之间的一个随机数。

document.write(parseInt(10*Math.random()));  //输出0~10之间的随机整数
document.write(Math.floor(Math.random()*10+1));  //输出1~10之间的随机整数
原文地址:https://www.cnblogs.com/dianzan/p/8528701.html