js封装 |随机获取指定范围内的整数
function range(lowerValue,upperValue){
let total=upperValue-lowerValue+1
return Math.floor(Math.random()*total+lowerValue)
}
range(1,10)
function range(lowerValue,upperValue){
let total=upperValue-lowerValue+1
return Math.floor(Math.random()*total+lowerValue)
}
range(1,10)