Hello devs,
javascript random number between two numbers in today's tutorial. In this quick example, I will show you how we can generate random number in javascript between two number like javascript random number between 10 and 100.
I will use math random to generate random numbers in javascript. I will share the source code of javascript random number between range. So let's see the example of math random between two numbers:
Example code:
function getRandomNumbersBetweenRange(min, max) {
return Math.random() * (max - min) + min;
}
// you can also use
function getRandomNumbersBetweenRange(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
Hope it can help you.
#javascript