P ProbLab
Tools/Gambler's Ruin Simulator

Gambler's Ruin Simulator

Probability of reaching a target bankroll before going broke, given a per-bet win probability and a fixed unit bet. Includes expected duration and a multi-session visualization.

Setup

Advertisement

Result

Session trajectories

Each line = one session's bankroll over time. Lines that touch 0 = ruin; lines that reach the target line = success.

The formula this tool uses

The classical gambler's ruin formula gives the probability of reaching target T starting from S when each bet pays b:1 with win-probability p:

If p = 1/(b+1): P(reach T) = S / T
Otherwise: P(reach T) = (1 - r^S) / (1 - r^T), where r = (1-p)/(p·b)

Who uses it

  • Educators illustrating the random walk and the surprising danger of small −EV bets over many trials.
  • Quants modeling risk of ruin in trading strategies.
  • Gamblers confronting the math (most find it sobering).

Limitations

  • Assumes flat bets of 1 unit — no martingale or variable sizing.
  • Assumes bets are independent — no hot/cold streak memory.
  • Assumes infinite time. The simulation caps bets at 2000 to keep runtime fast; sessions that don't terminate in that many bets are counted as neither ruin nor target.