Question : random number 0 to 3
Answered by : calm-coyote-psd0wf42ntb1
// Between any two numbers
Math.floor(Math.random() * (max - min + 1)) + min;
// Between 0 and max
Math.floor(Math.random() * (max + 1));
// Between 1 and max
Math.floor(Math.random() * max) + 1;
Source : | Last Update : Sun, 16 Feb 20
Question : js generate random number
Answered by : rich-raven-q9ozeya4w1y7
function getRandomArbitrary(min, max) { return Math.random() * (max - min) + min;
}
Source : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random | Last Update : Wed, 02 Dec 20