标签:return random cti max math choices 整数 turn alert
function randomNum(minNum,maxNum){
var choices = maxNum - minNum + 1;
return Math.floor(Math.random() * choices + minNum);
}
var num = randomNum(2, 10);
alert(num); //2-10的随机数(包括2或10);
标签:return random cti max math choices 整数 turn alert
原文地址:http://www.cnblogs.com/rongy/p/6613436.html