Skip to content

Instantly share code, notes, and snippets.

@Glench
Last active December 14, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Glench/5126225 to your computer and use it in GitHub Desktop.
Save Glench/5126225 to your computer and use it in GitHub Desktop.
calculate percentage chance, returning true or false. basically equivalent to spinning a roulette wheel and telling you if you won on that round or not.
var percentChance = function(integerPercent) {
return Math.random()*100 < integerPercent;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment