Math.random()
可以用来生成一个0-1之间的随机数
申城一个0-10之前的随机数
生成0-x之间的随机数
Math.round(Math.random()*x)
生成0-10的随机数
生成一个x-y之间的随机数
Math.round(Math.randow()*(y-x))+x
for(var i=0;i<100;i++){
//生成1-6之前的随机数
console.log(Math.round(Math.random()*5)+1)
}
Math.random()
可以用来生成一个0-1之间的随机数
申城一个0-10之前的随机数
生成0-x之间的随机数
Math.round(Math.random()*x)
生成0-10的随机数
生成一个x-y之间的随机数
Math.round(Math.randow()*(y-x))+x
for(var i=0;i<100;i++){
//生成1-6之前的随机数
console.log(Math.round(Math.random()*5)+1)
}