Skip to content

Instantly share code, notes, and snippets.

@kuon
Last active April 25, 2017 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuon/a655d6fd9482297f0baa4c5448f4a696 to your computer and use it in GitHub Desktop.
Save kuon/a655d6fd9482297f0baa4c5448f4a696 to your computer and use it in GitHub Desktop.
Random int
// Generates a random int within a and b inclusive
function randomIntWithinRange(a, b) {
var range = a - b
var random = Math.random() * range
return a - Math.round(random)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment