Last active
August 29, 2015 14:22
-
-
Save jesusalber1/b38489934a591c22ca7e to your computer and use it in GitHub Desktop.
Get random between two integers
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
/* 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