Skip to content

Instantly share code, notes, and snippets.

@coffeetocode
Created October 1, 2016 22:12
Show Gist options
  • Save coffeetocode/cabc8bb713dd734dc9ce3f5f4f9c0564 to your computer and use it in GitHub Desktop.
Save coffeetocode/cabc8bb713dd734dc9ce3f5f4f9c0564 to your computer and use it in GitHub Desktop.
var results = {"Erin Ptacek": {0:0, 1:0, 2:0},
"Thomas Ptacek": {0:0, 1:0, 2:0},
"Jeremy Rauch": {0:0, 1:0, 2:0},
};
for(var i = 0; i < 1000000; i++) {
var arr = ["Erin Ptacek", "Thomas Ptacek", "Jeremy Rauch"].sort(function(x, y) { return 1 - Math.ceil(Math.random() * 100) % 3; });
for(var name in results) {
results[name][arr.indexOf(name)]++;
}
if(i % 1000 == 0) {
console.log(i);
}
}
for(var name in results) {
console.log(name);
console.log(results[name]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment