Source : How to generate a random number between two numbers in JavaScript
This tutorial explains how to generate a random number between two numbers in JavaScript. To generate random in react native application we are going to use JavaScript inbuilt function Math.floor() and Math.random() function is used in this tutorial. The Math.floor() function is used to round the given number to its downward integer value. The Math.random() function is used to Generate Random Number to any range in Point Float value. So we would use both Math.floor() and Math.random() function together to generate random number between given range.
The simplest possible way to randomly pick a number between two and Use a combination of Math.floor() and Math.random().
Top comments (0)