获取范围内的随机整数
function getRandomNumber(min,max){
min = Math.ceil(min); //向上取整
max = Math.floor(max); //向下取整 Math.round(num) 四舍五入
return Math.floor(Math.random()*(max-min+1)+min)
}
getRandomNumber(5,10)
function getRandomNumber(min,max){
min = Math.ceil(min); //向上取整
max = Math.floor(max); //向下取整 Math.round(num) 四舍五入
return Math.floor(Math.random()*(max-min+1)+min)
}
getRandomNumber(5,10)