Skip to content

Instantly share code, notes, and snippets.

@romuleald
Created September 29, 2014 16:08
Show Gist options
  • Save romuleald/908c20caaabfc34146a6 to your computer and use it in GitHub Desktop.
Save romuleald/908c20caaabfc34146a6 to your computer and use it in GitHub Desktop.
Random number beetwen range, with optional parameter to forbid a specific number
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