Created
September 29, 2014 16:08
-
-
Save romuleald/908c20caaabfc34146a6 to your computer and use it in GitHub Desktop.
Random number beetwen range, with optional parameter to forbid a specific number
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
function randomIntFromInterval(min, max, not) { | |
var _return = Math.floor(Math.random() * (max - min + 1) + min); | |
if(_return === not){ | |
return randomIntFromInterval(min, max, not); | |
} | |
return _return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment