Last active
March 8, 2018 04:09
-
-
Save dondevi/430633144c895f9127adf861b162bcbe to your computer and use it in GitHub Desktop.
Get Random Integer In Range.
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
/** | |
* 在指定范围内获取随机整数 | |
* @param {Number} min - 最小值 | |
* @param {Number} max - 最大值 | |
* @return {Number} | |
*/ | |
function getRandomIntInRange (min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment