Thought Toys · Chance · Exhibit 38

The drunkard's walk

Start exactly halfway between ruin and the goal, flip a fair coin at every step, and your odds are dead even — 50/50, whatever the distance. Tilt the coin just a little against you and stretch the walk out, and those odds don't just worsen. They collapse.

A number line from 0 (ruin) to N (the goal), with a walker starting halfway. The walker steps left or right with the set probability until it hits either end. Sliders set the per-step edge and the distance to the goal.

A fair coin from halfway is always 50/50.

your turn — drag the edge below 0.50, then stretch the distance

What you're seeing

A walker starts exactly halfway between two walls — ruin at one end, the goal at the other — and takes one step at a time, forward with probability p, back with probability 1−p, until it hits a wall. With a fair coin (p=0.50), the odds of reaching the goal first are exactly 1/2 — and that stays true whether the walk is 10 steps long or 200. Distance doesn't matter when the coin is fair; the symmetry never breaks.

Now tilt the coin. Drag p down to 0.47 — a modest 3-point disadvantage, the kind a casino game might quietly build in — and watch the goal-probability column on the right. At a short distance (10 steps) you're still at 35%, not bad. Stretch the walk to 40 steps and it falls to 8%. At 200 steps it's effectively zero — about six in a million. The same 3-point tilt, just given more room to compound.

That's the whole mechanism behind "the house always wins eventually": no single round needs to feel unfair, and it doesn't have to be a large edge. A long enough game turns any persistent disadvantage, however small, into near-certain ruin. Hit run 2,000 trials to watch the empirical rate confirm the exact number, one simulated walker at a time.

The rule, exactly. Started at k with a far wall at N, the exact probability of reaching the goal before ruin is P = kN at p=½,   else   (1(qp)k) ⁄ (1(qp)N) — a gambler's ruin formula — the classic closed-form answer to this exact walk. Verified in node (improve/verify/38-drunkards-walk.js): the formula matches a 200,000-trial Monte Carlo simulation within 1.5% across several (p, N) pairs, and at p=0.47 the goal-probability strictly falls as N grows (35% → 8.3% → 0.81% → 0.0006%). Counter-example: at p=0.5 exactly, the probability from halfway stays pinned at exactly 0.5 for every N tested up to 500 — no collapse at all — which proves the collapse above is caused specifically by the coin being unfair, not by the walk simply being long.

Also in Chance: The coupon collector's problem →

All 16 in Chance
  1. 05The Galton board
  2. 06The Monty Hall problem
  3. 115Play the best machine and you never find the best machine
  4. 119A bet worth infinity that nobody will pay $20 for
  5. 124Shuffle seven times and stop
  6. 13Buffon's needle
  7. 130The walk that always comes home
  8. 14The central limit theorem
  9. 30Markov chains
  10. 31Averages that never settle
  11. 35The birthday paradox
  12. 38The drunkard's walk — you are here
  13. 42The coupon collector's problem
  14. 52Genetic drift
  15. 63The gaps are chaos. The count is law.
  16. 76Every bet here has an edge. Some sizes still go broke.

← the cabinet · Thought Toys — a cabinet of explorable explanations. Exhibit 38.