javascript return random int in range code example
Example 1: javascript get random floating number
const randomFloat = (min, max) => Math.random() * (max - min) + min;
Example 2: javascript generate a random integer number in a range of numbers
const min = 1;
const max = 4;
const intNumber = Math.floor(Math.random() * (max - min)) + min;
console.log(intNumber); //> 1, 2, 3