how to get radom numbers js code example
Example 1: javascript get random number
// Returns a number between min and max
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
Example 2: get random numbers javascript
//Write the following code to get a random number between 0 and n
Math.floor(Math.random() * n);