javascript math floor random code example
Example 1: math.random javascript
Math.random()
Math.floor(Math.random() * 10)
Math.floor(Math.random() * 11)
function randomNum(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
Example 2: generate random number javascript
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
Example 3: javascript random number between 0 and 10
Math.floor(Math.random() * 10);
Example 4: math.random js
Math.floor(math.random() * 10);