js封装 |随机获取指定范围内的整数

function range(lowerValue,upperValue){
    let total=upperValue-lowerValue+1
    return Math.floor(Math.random()*total+lowerValue)
}

range(1,10)
posted @ 2021-02-11 12:21  sanhuamao  阅读(139)  评论(0编辑  收藏  举报