Created
November 25, 2013 10:38
-
-
Save simonrenoult/7639459 to your computer and use it in GitHub Desktop.
Generate a random number. Default range is 10 000. Will fail with a boolean (range will be cast into a 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
var getRandomID = function ( range ) { | |
var r = range; | |
if ( isNaN ( r ) ) { | |
r = 10000; | |
} | |
return Math.floor ( Math.random() * r ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment