Skip to content

Instantly share code, notes, and snippets.

@olekenneth
Last active August 25, 2016 08:27
Show Gist options
  • Select an option

  • Save olekenneth/abd932ed33ce63e6377fa9cfa2bfd289 to your computer and use it in GitHub Desktop.

Select an option

Save olekenneth/abd932ed33ce63e6377fa9cfa2bfd289 to your computer and use it in GitHub Desktop.
Random picker
var t = "";
var testRandom = function(times, every) {
var i = 0;
var number = 0;
while(times > i) {
if (Math.floor(Math.random() * every) === (every - 1)) {
number++;
}
i++;
}
t += "Picked: " + number + " - Ran: " + i;
document.write(t);
};
testRandom(1000,5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment