Last active
January 30, 2021 05:08
-
-
Save steveshead/22fcb0cc4652f5722242db0a3deb7005 to your computer and use it in GitHub Desktop.
[Javascript Random Number Generator] - create a constant that takes two number inputs to generate a random number between those two number
This file contains 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
const randomInt = (min, max) => Math.floor(Math.random() * (max - min) + 1) + min; | |
console.log(randomInt(10, 20)); | |
// Used floor instead of trunc so negative numbers can be used |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment