Created
May 30, 2012 14:34
-
-
Save glauberramos/2836687 to your computer and use it in GitHub Desktop.
3 Doors (One with a reward) problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doors = [false, false ,true]; | |
var didntChangeDoorCount = 0; | |
var changedDoorCount = 0; | |
for(i=0;i<10000;i++) { | |
var picker = Math.floor(Math.random()*3); | |
//dont change | |
if(doors[picker]) didntChangeDoorCount++; | |
//change | |
if(!doors[picker]) changedDoorCount++; | |
}; | |
console.log("Dont Change Count: ", didntChangeDoorCount, " | Change Count: ", changedDoorCount); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment