Gambler’s Ruin Calculator | Discrete Random Walk Model

The Gambler’s Ruin problem is a classic probability model. It asks a simple question: if a gambler starts with i units and keeps playing until they either lose everything or reach a target of N units, what is the probability of ruin and success?

This Gambler’s Ruin Calculator uses a discrete random walk model. Each step moves the bankroll up or down by exactly one unit. The process stops when the bankroll reaches 0 or the chosen target.

Important: this is a fixed-unit model. It is useful for coin-flip style bets, even-money games and simplified bankroll examples. It does not fully model games with variable payouts, pushes, doubles, splits, parlays, changing bet sizes or progressive staking systems.

Gambler’s Ruin Calculator

Discrete random walk with ruin and target barriers.

Discrete Model
This model assumes fixed ±1 unit steps, independent rounds, no pushes and two absorbing barriers: 0 and target units.
Probability of ruin -- Run the model to calculate absorption probabilities.
Probability of success --
Expected duration --
Starting position --
Step drift --
q / p ratio --
Model used --
Ruin
Success
Ongoing
Show formulas Biased game: r = q / p P(success) = (1 - r^i) / (1 - r^N) P(ruin) = 1 - P(success) Fair game: P(success) = i / N P(ruin) = 1 - i / N E[duration] = i × (N - i) Finite horizon: Dynamic programming over states 0...N.
Expected duration is a mean. Individual stopping times can vary widely, especially when p is close to 0.5.

How to Use the Gambler’s Ruin Calculator

This tool models a simple random walk with absorbing barriers. Every round, your balance moves up by one unit after a win or down by one unit after a loss.

  1. Starting units: your current bankroll measured in bet-sized units.
  2. Target units: your walk-away goal. The target must be higher than the starting bankroll.
  3. Win probability: the chance of winning one unit step.
  4. Finite horizon: optional. Use this if you want to limit the model to a fixed number of steps.
  5. Dollar converter: optional. Convert bankroll, bet size and target from money amounts into units.

For broader bankroll tools, use the Bankroll Risk Calculators Hub. For a fixed-stake risk model using odds and win rate, use the Risk of Ruin Calculator.


What the Model Measures

Output Meaning
Probability of ruin The chance that the walk reaches 0 units before reaching the target.
Probability of success The chance that the walk reaches the target before reaching 0 units.
Expected duration The average number of steps until the walk hits either boundary.
Ongoing probability In finite horizon mode, the chance that neither boundary is reached before the step limit.

The Formulas

Biased Game: p ≠ q

Let p be the probability of winning one step and q = 1 – p be the probability of losing one step. Let r = q / p.

P(Success from i) = (1 – ri) / (1 – rN)

P(Ruin) = 1 – P(Success)

E[Duration] = i / (q – p) – N × P(Success) / (q – p)

Fair Game: p = q = 0.5

For a fair game, the formulas simplify:

P(Success from i) = i / N

P(Ruin) = 1 – i / N

E[Duration] = i × (N – i)

Finite Horizon

Finite horizon mode uses dynamic programming. Probability mass starts at the initial bankroll state. At each step, non-boundary states split into win and loss paths. Any probability that reaches 0 or N is absorbed. After the chosen step limit, remaining probability is shown as ongoing.


Model Assumptions

  • Fixed ±1 unit steps: every round wins exactly one unit or loses exactly one unit.
  • Constant win probability: p does not change between rounds.
  • Independent rounds: the previous result does not affect the next result.
  • No pushes: every round moves the bankroll up or down.
  • Two absorbing barriers: the walk ends only at 0 or the target.

Games such as blackjack, poker, parlays and variable-stake strategies do not perfectly fit this model because outcomes and payouts are not always ±1 unit. Use game-specific calculators for those cases.


Worked Examples

Example 1: Fair Game

You start with 50 units and want to reach 100 units. The game is a fair coin flip with p = 0.5.

  • P(Success): 50 / 100 = 50.00%
  • P(Ruin): 50.00%
  • Expected duration: 50 × 50 = 2,500 steps

In a fair game, the success probability is proportional to the starting position between 0 and the target.

Example 2: European Roulette Even-Money Bet

For a European roulette red/black bet, the probability of winning is 18/37 ≈ 0.4865. With 50 starting units and a target of 100 units, the negative drift sharply increases ruin probability.

This shows why a small house edge can become severe over many repeated steps. The target is your only stopping rule; without it, a negative-expectation walk tends toward eventual ruin.

Example 3: Small Player Edge

If p = 0.51, the player has a small edge. Starting with 50 units and targeting 100 units gives a much higher success probability than a fair game. But the expected duration can still be large, and a short finite-horizon session may often end with neither ruin nor success.


Infinite Horizon vs Finite Horizon

Mode Best for Output
Infinite horizon Long-run model where play continues until 0 or target. Ruin probability, success probability and expected duration.
Finite horizon Session model with a limited number of steps. Ruin probability, success probability and ongoing probability.

Finite horizon mode is often more practical for real sessions because most players do not play indefinitely. It also shows why a positive edge may not have enough time to appear in a short session.



Frequently Asked Questions

What is an absorbing barrier?

An absorbing barrier is a state that ends the process once reached. In this model, 0 is the ruin barrier and N is the success target.

What is the difference between infinite and finite horizon?

Infinite horizon assumes play continues until ruin or success. Finite horizon limits the number of steps and adds a third result: ongoing probability.

Does bet sizing affect Gambler’s Ruin?

Yes, through the unit conversion. If you have $1,000 and bet $10, you have 100 units. If you bet $100, you have 10 units. Fewer units usually means higher ruin risk.

Can I use this model for blackjack?

Only as a rough approximation. Blackjack has pushes, doubles, splits, blackjacks and variable payouts, so a blackjack-specific risk calculator or simulation is more appropriate.

Why is expected duration important?

It estimates the average number of steps before the walk reaches ruin or success. The actual stopping time can be much shorter or much longer, especially when p is close to 0.5.

What happens if the casino has an unlimited bankroll?

If the game has negative expectation and there is no fixed walk-away target, eventual ruin becomes the long-run outcome in the idealized model. Setting a target or stopping rule changes the modeled process.


Responsible gambling notice: probability models do not make gambling safe or profitable. Use strict limits and never stake money you cannot afford to lose.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top