Created
May 16, 2016 12:29
-
-
Save anonymous/fd32df949e8bbe9c0c2c7395e8c915e9 to your computer and use it in GitHub Desktop.
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
<? | |
$choices=array(1,2,2); | |
$good=1; | |
$max=100000; | |
for($i=0;$i<$max;$i++){ | |
$cards=$choices; | |
shuffle($cards); | |
$choosen=$cards[array_rand($cards)]; | |
foreach($cards as $k => $c){ | |
if($c != $choosen && $c != $good && count($cards) > 2 ){ | |
unset($cards[$k]); | |
} | |
} | |
if($choosen == $good){$keep++;} | |
else{$change++;} | |
} | |
echo " Keep : $keep / Change : $change"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment