Skip to content

Instantly share code, notes, and snippets.

View CalvinCarmack's full-sized avatar

CalvinCarmack

View GitHub Profile
@CalvinCarmack
CalvinCarmack / montyhall.php
Created September 15, 2013 01:08
Monty Hall problem
<?php
function play($strategy, $games = 10) {
$wins = 0;
for ($x = 0; $x < $games; $x++) {
$car = rand(0, 2);
$choice = rand(0, 2);
@CalvinCarmack
CalvinCarmack / envelopes.php
Last active December 23, 2015 02:29
Two Envelopes
<?php
function play($switch, $games, $small) {
$wins = 0;
$winnings = 0;
for ($x = 0; $x < $games; $x++) {
//which envelop is double the amount
$double = rand(0, 1);