Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2016 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fd32df949e8bbe9c0c2c7395e8c915e9 to your computer and use it in GitHub Desktop.
Save anonymous/fd32df949e8bbe9c0c2c7395e8c915e9 to your computer and use it in GitHub Desktop.
<?
$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