random number between 0 and 5 javascript code example
Example 1: random js
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min)) + min + 1;
}
Example 2: random in a range js
const rnd = (min,max) => { return Math.floor(Math.random() * (max - min + 1) + min) };