Skip to content

Instantly share code, notes, and snippets.

@cpetzold
Created January 26, 2011 23:45
Show Gist options
  • Save cpetzold/797768 to your computer and use it in GitHub Desktop.
Save cpetzold/797768 to your computer and use it in GitHub Desktop.
Math.randInt = function(f, t) {
var from = (t) ? f : 0;
var to = t || f;
return from + (Math.random() * (to - from + 1)).floor();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment