Random Number
Category: JavaScript
function randomNumber(min = 0, max = 1) { return Math.random() * (max - min) + min;}
Usage
You can just call the function any time. Its parameters are optional, so you can decide where to place your lower and upper bounds.
If you’re looking for a random integer instead, take a look here
// Generates a random number between 0 and 1const rndOne = randomNumber();
// Generates a random number between 0 and 10const rndTwo = randomNumber(0, 10);