how to find a random number in any range code example
Example 1: generate random whole numbers within a range
var myMin = 1;
var myMax = 10;
function randomRange(myMin, myMax) {
return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
}
console.log(randomRange(myMin, myMax));
Example 2: random in range
// Get a random number between 20 and 30
Math.round((Math.random() * (30 - 20 + 1)) + 20);