Skip to content

Instantly share code, notes, and snippets.

@simonrenoult
Created November 25, 2013 10:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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).
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