Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 10

Should You Pay $250 To Play This Casino Game?

Suppose a casino invents a new game that you must pay $250 to play. The game works like this: The casino draws random numbers between 0 and 1, from a uniform distribution. It adds them together until their sum is greater than 1, at which time it stops drawing new numbers. You get a payout of $100 each time a new number is drawn.

For example, suppose the casino draws 0.4 and then 0.7. Since the sum is greater than 1, it will stop after these two draws, and you receive $200. If instead it draws 0.2, 0.3, 0.3, and then 0.6, it will stop after the fourth draw and you will receive $400. Given the $250 entrance fee, should you play the game?

Specifically, what is the expected value of your winnings?

The Riddler, FiveThirtyEight(original post)

Solution

Let NN be the number of draws the casino makes, so the payout is 100N100N and we need E[N]\mathbb{E}[N]. Write SnS_n for the sum of the first nn uniform draws. The game is still running after nn draws exactly when Sn1S_n \le 1, that is, when N>nN > n.

The chance that nn independent uniform[0,1][0,1] values sum to at most 11 is the volume of the simplex {x1++xn1, xi0}\{x_1+\cdots+x_n \le 1,\ x_i \ge 0\}, which is the clean Pr(Sn1)=1n!.\Pr(S_n \le 1) = \frac{1}{n!}. (Each ordering of the nn values is equally likely and fills one of the n!n! congruent pieces of the unit cube, and exactly one ordering keeps the running sum inside the simplex.) Summing the tail probabilities, E[N]=n=0Pr(N>n)=n=0Pr(Sn1)=n=01n!=e.\mathbb{E}[N] = \sum_{n=0}^{\infty} \Pr(N > n) = \sum_{n=0}^{\infty} \Pr(S_n \le 1) = \sum_{n=0}^{\infty} \frac{1}{n!} = e. So on average the casino makes ee draws and your expected payout is 100e$271.83.100\,e \approx \boxed{\$271.83}. That clears the $250 fee by about $21.83 in expectation, so the game is worth playing.

The computation

Play the game itself: draw uniform values until the running sum first exceeds 11, count the draws, multiply by $100, and average over many plays. The mean lands on 100e100\,e.

import numpy as np
rng = np.random.default_rng(0)
runs = 2_000_000
total_payout = 0
for _ in range(runs):
    s = 0.0; draws = 0
    while s <= 1:                 # keep drawing until the sum exceeds 1
        s += rng.random(); draws += 1
    total_payout += 100 * draws
print(total_payout / runs)        # ~271.83 = 100 * e