首页 > 技术文章 > js生成一个指定范围内的随机整数

aleng-liu 2018-11-06 23:02 原文

function __random(start=0, end=1) {
  return Math.floor(Math.random() * (end - start + 1) + start);
}

console.log(__random(3,100));

推荐阅读