📌  相关文章
📜  如何在某些值之间生成随机数 - Javascript 代码示例

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

代码示例1
// How to generate a random number between specific values:

// Math.floor() rounds its argument down to the nearest whole number.
//Math.random() generates a float value between 0 and 0.999999999999999999999999

var highnum = 10 //Type your highest number here.
var lownum = 1 //Type your lowest number here.

var randomnumber = Math.floor(Math.random()*highnum + lownum)