random 4 integers in range javascript code example
Example 1: javascript get random integer in given range
const randomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + 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
Example 3: javascript random number between 0 and 10
Math.floor(Math.random() * 10);