Created
April 3, 2014 16:31
-
-
Save dylants/9957843 to your computer and use it in GitHub Desktop.
Generate a number between low and high
This file contains hidden or 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
/** | |
* Generates a number between low and high | |
* | |
* @param {Number} low The lower bound for the number generator | |
* @param {Number} high The upper bound for the number generator | |
* @return {Number} A number between low and high | |
*/ | |
function generateNum(low, high) { | |
return Math.floor(Math.random() * ((+high) - (+low) + 1)) + (+low); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment