Skip to content

Instantly share code, notes, and snippets.

@jesusalber1
Last active August 29, 2015 14:22
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 jesusalber1/b38489934a591c22ca7e to your computer and use it in GitHub Desktop.
Save jesusalber1/b38489934a591c22ca7e to your computer and use it in GitHub Desktop.
Get random between two integers
/* Forked from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random */
/* This function returns a random integer between two numbers, both included (min - max) */
function getRandomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
/* var random = getRandomInteger(0, 5); */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment