Quick start with Math.random

Photo by the author
How would you generate a random number? What about a random string?
You may already know the built-in Math.random function. It generates a random number between 0 and 1, not including the 1 number.
Generating a Random Number
Below is an example of using this utility.
const no = Math.random();
console.log(no);
//0.9045660913804647
As you can notice the given result is a decimal number.
How can we generate an integer number in a specific interval?
To get a num...
Published on March 08, 2023 01:54