Skip to content

Instantly share code, notes, and snippets.

@RadicalPet
Created February 14, 2015 06:41
Show Gist options
  • Save RadicalPet/29584dee37921690cd38 to your computer and use it in GitHub Desktop.
Save RadicalPet/29584dee37921690cd38 to your computer and use it in GitHub Desktop.
Now leave me alone with that coin bullshit!
50%, You choose one of the coins to be heads and then toss the other:
_____________________________________________________________________
var count10 = 0;
var count11 = 0;
function fuckYouAll(){
var chooseOne = Math.round(Math.random());
var coin;
var coin2;
if (chooseOne == 0){
coin = 1;
coin2 = Math.round(Math.random());
}
else{
coin2 = 1;
coin = Math.round(Math.random());
}
if (coin == coin2){
count11 = count11 + 1;
}
else{
count10 = count10 + 1;
}
}
for (var i = 0; i < 1000; i++){
fuckYouAll();
}
console.log("11: " + count11);
console.log("10: " + count10);
33%, You toss both and toss them again if both are tails:
_____________________________________________________________________
var count10 = 0;
var count11 = 0;
function fuckYouAll(){
var coin = Math.round(Math.random());
var coin2 = Math.round(Math.random());
if (coin == 0 && coin2 == 0){
fuckYouAll();
}
else if (coin == 1 && coin2 == 1){
count11 = count11 + 1;
}
else{
count10 = count10 + 1;
}
}
for (var i = 0; i < 1000; i++){
fuckYouAll();
}
console.log("11: " + count11);
console.log("10: " + count10);
25%, You toss one and if it is heads you toss the other, if it is tails you set the other to heads
______________________________________________________________________
var count10 = 0;
var count11 = 0;
function fuckYouAll(){
var coin = Math.round(Math.random());
var coin2;
if (coin == 1){
coin2 = Math.round(Math.random());
}
else{
coin2 = 1;
}
if (coin == coin2){
count11 = count11 + 1;
}
else{
count10 = count10 + 1;
}
}
for (var i = 0; i < 1000; i++){
fuckYouAll();
}
console.log("11: " + count11);
console.log("10: " + count10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment