Skip to content

Instantly share code, notes, and snippets.

@neysidev
Created May 31, 2023 03:41
Show Gist options
  • Select an option

  • Save neysidev/d4601be8e55d2537b00d31b72713bc89 to your computer and use it in GitHub Desktop.

Select an option

Save neysidev/d4601be8e55d2537b00d31b72713bc89 to your computer and use it in GitHub Desktop.
// https://stackoverflow.com/questions/4959975/generate-random-number-between-two-numbers-in-javascript
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
const rndInt = randomIntFromInterval(1, 6)
console.log(rndInt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment