js工具函数:随机生成规定范围内的整数

function randomFn(min, max) {
    return Math.floor(Math.random() * Math.floor(max - min)) + min;
}
randomFn(2,6) // 3
posted @ 2021-01-21 22:09  老邓头3247  阅读(93)  评论(0)    收藏  举报