A while back I was in a discussion with a relative who was having difficulty understanding, intuitively, how the Monty Hall problem works out; understandable, as it is incredibly counter-intuitive, at first!

I wrote this simple PHP script to simulate the Monty Hall problem and show, statistically, that switching your choice does in fact improve your odds substantially. It will accept trial sizes as large as 10,000 attempts.

For more about this interesting puzzle, check out the post I wrote about the Monty Hall Problem.