GenerateRandomSearch

Monty Hall Simulator

The answer that nobody believes: switching wins two thirds of the time. The reason is that your first pick is right one time in three and the host opening doors cannot change that — so switching wins exactly when staying loses. Running it thousands of times does not prove the theory, and this page never pretends otherwise: the exact probability and the observed rate are shown side by side, close but not equal. You can also play a round yourself: pick a door, watch the empty ones open, and decide whether to keep the one you started with.

What this generator does

Simulates the game with as many doors as you like. Because the host always opens every other losing door, switching wins exactly when the first pick was wrong — so the bulk simulation tracks that directly rather than opening doors one by one. Playing a round by hand does deal the doors properly, and your own record for staying and for switching is kept apart.

How to use this tool

  1. Play a few rounds by hand first, picking a door and then deciding whether to keep it.
  2. Choose how many doors and how many runs.
  3. Predict the switch and stay rates before running.
  4. Compare the observed rates with the exact ones.
  5. Raise the door count to a hundred, where the answer stops being surprising.

Understanding the controls

How many doors
Three is the classic. At a hundred doors the reasoning becomes obvious, which is why that version convinces people the three-door answer is right.
How many runs
From 100 to 20,000. More runs bring the observed rate closer to the theory, and the gap shrinking is itself worth watching.
Seed
Any word reproduces exactly the same sequence of games, so a surprising run can be shown to someone else. It applies to the bulk run; a round you play by hand is always drawn fresh.
Play a round yourself
Pick a door, and every door but yours and one other is opened to show it is empty. Keep your door or switch to the one still closed, and your record for each decision is tallied separately.

Common use cases

  • Settling the argument with a run people can watch
  • Showing that more doors make the reasoning obvious
  • Teaching the difference between a proof and a simulation
  • Demonstrating sampling error at different run counts
  • Letting somebody play a few rounds before being shown the arithmetic
  • Reproducing a surprising three-door run from a seed

How this generator works

Each run draws a prize door and a chosen door. Staying wins when they match; switching wins when they do not. The check requires the theoretical probabilities to be exactly one over the door count and its complement, and the observed rate to sit within three standard errors of the theory — a band that widens as the run count falls. A round played by hand is dealt in full instead — a prize door, a chosen door, and a host who may open neither — and it is checked that the host opened exactly the doors he was allowed to and left one alternative closed.

Randomness and fairness

The prize and the pick are random; the probabilities are computed in closed form. Seeded runs reproduce exactly and are therefore explicitly not cryptographically secure. Unseeded, the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • The host always knows where the prize is and always opens losing doors. A host who opens doors at random gives a different answer entirely.
  • Your own record over a handful of rounds proves nothing either way, which is what the bulk run is for.
  • Doors stop at a hundred, which is well past the point the reasoning becomes clear.
  • A finite run never proves the theory; it is only consistent with it.
  • Runs are not kept, so seed a surprising one before you close the page.

Privacy and your data

Every run happens in your browser. No settings, seeds or results are transmitted or stored.