Created
September 28, 2016 03:32
-
-
Save oti/fd048534e11a1dabc9badbfaa0163a2e to your computer and use it in GitHub Desktop.
random integer
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
function randomInteger(range){ | |
retunr Math.floor(Math.random() * range); | |
} | |
// <range> is range of number. | |
// randomInteger(2) // -> 0 or 1 | |
// randomInteger(10) // -> 0,1,2,3,4,5,6,7,8,9 | |
// randomInteger(100) // -> 0,1,2,...,98,99 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment