Languages
[Edit]
EN

JavaScript - random int in range

4 points
Created by:
Root-ssh
178180

Hi, today I would like to show you how to generate random integer number in the given range in JavaScript.

Random int between 0 and 2

Edit

If we want to change the range, we just need to call this method with our desired min and max.

About min and max value as stated in a comment:

  • inclusive min (result can be equal to min value)
  • inclusive max (result can be equal to min value)
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript - random

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join