How do you generate random integers

Posted by Andre Scott | Updated on

You can use Math.random() with Math.floor() to return random integers. For example, if you want generate random integers between 1 to 10, the multiplication factor should be 10,

Note: Math.random() returns a random number between 0 (inclusive), and 1 (exclusive)


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers