Created
February 1, 2018 22:50
-
-
Save brazilnut2000/211b3b71241ce0bfe7c69f345de90d36 to your computer and use it in GitHub Desktop.
Get a random number between 0 and whatever upper-range you specify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomNumber(range) { | |
return Math.round(Math.random() * range); | |
} | |
// Usage: | |
console.log(`This is a random number from 0 to 20: ${randomNumber(20)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment