math.random in js MDN code example
Example 1: random js
function randomNumber(min, max) {
return Math.floor(Math.random() * (max - min)) + min + 1;
}
Example 2: javascript get random floating number
const randomFloat = (min, max) => Math.random() * (max - min) + min;