Random Number

Generates a random number within a specified range.

Contributed by @itsbrunodev

javascript
function randomNumber(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
javascript
randomNumber(1, 10); // 5
GitHubEdit on GitHub