📜  javascript random int in range - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:50.253000             🧑  作者: Mango

代码示例6
function randomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1) + min)
}

console.log(randomInt(1, 6)) // random integer between 1 and 6