Stacking Prompts

Suppose I have a game that involves rolling on a table of prompts. The table has ten entries and I’m going to roll eleven times. Necessarily, at least one prompt will be repeated.

We can write one more prompt and select them in a random order. This guarantees there are no repeats, but doesn’t allow for a twelfth selection, and shuffling” is different from rolling. We would like to keep the flexibility of a variable number of rolls while minimizing the number of repetitions.

We could write 90 more prompts,1 but that’s a lot of work. Let’s say that I’ve got ten more prompts in me. How best can I use these?

Option One: Twenty Prompts

We can add our ten prompts to the end of the list, selecting randomly from all twenty. If we do this, the odds of a repeated prompt in eleven rolls are the odds of rolling at least one duplicate.

This can be solved like the birthday problem: we calculate the number of ways we can roll no duplicates, and then invert it to find the odds of rolling a duplicate. There are 20!(2011)! permutations of 11 different items selected from 20. There are 201120^{11} total ways to select 11 items, different or the same, in any order. So the probability of rolling 11 times with no duplicated prompts is then


Option Two: Ten Prompts, Two Deep

Suppose instead that we take our ten additional prompts and put one after each of our first ten prompts, as a backup. You will still necessarily repeat at least one roll, but the second time you roll it, you use the backup” prompt. So the odds of receiving a duplicated prompt are now the odds of rolling a triplicate number.

The solution is similar to the first one: we count the total number of acceptable rolls and then divide by the total number of possible rolls. But counting acceptable rolls is more complicated here. In a collection with dd doubles in it, there are (1011d) values. For each of those collections, we then need to select dd values to be doubled, which can be done (11dd) ways. Then there are 11!2d permutations of each one and 101110^{11} total ways to select 11 items any number of times in any order. Putting this all together, we get the probability of rolling with no triplicate prompts:2



In general, raising the bar for repetition from doubles,” which are surprisingly common, to triples” seems to be much more effective than trying to make the odds of doubles smaller directly. Prompts will still be repeated in any scheme, but we’ve lowered it from a practical certainty (~97%) to merely something frequent (~72%) while conserving the amount of prompt-writing needed.3

There’s another benefit to nesting prompts like this, and it’s that it gives the structure a memory.” The second prompt can refer back to the first, with certainty that it’s already been used. (I understand this is what Thousand Year Old Vampire does, but I haven’t read it.)

There are some complications also. The structure is a little harder to explain, and while prompts are less likely to be exhausted, not all prompts are equally likely to be selected.

What about triples?

I was going to stop there, but suppose I find ten more prompts in me, and we nest them three deep. This math is similar. First we choose 11d2t11-d-2t values from our ten options. From those, we pick tt triples. Then from the remaining 11d3t11-d-3t values we choose dd doubles. There are now 11!(2!)d(3!)t=11!2d6t= permutations. Putting it together, we get:4


It’s a little more complicated than I could casually evaluate, so I wrote a Python script:


# March 2024
# Ian McDougall

# Calculate the odds of drawing a single item no more than three times when drawing from 10 items 11 times (with replacement).

from scipy.special import comb
from math import factorial

P = 0
f11 = factorial(11)

for t in range(4):
    for d in range(6):
        val = 11 - d - 2*t
        part = comb(10, val)
        part *= comb(val,t)
        part *= comb(val-t,d)
        part *= f11/(2**d * 6**t)
        P += part
P *= 1/10**11


If I did the math right, this is by far the most efficient thing to do! Exhausted prompts are still inevitable, but we’ve made them rarer than if we’d written 100 prompts, for only a third of the effort.

It’s also worth noting that these nested” prompts don’t need to be ordered. Ten pick-lists of three has the same odds as ten sequences of three.

  1. This raises the odds of not a repeating prompt to


    up from zero, which isn’t terrible.↩︎

  2. Many, many thanks to TEST on the MSE Discord server, who helped me work through this math when I had misconstructed it, multiple times. They also proposed a different, equivalent formulation:


    in which we first choose our doubled numbers in (10d) ways and then choose our remaining single items in (10d112d) ways. Perhaps you will find this more intuitive.↩︎

  3. In the flat” prompt structure, you’d need 47 prompts total to reach the same odds as the nested structure. I have no work to show here, I just asked Wolfram Alpha.↩︎

  4. We’re allowed to be a little loose with the limits of our summations here because (n0)=(nn)=1 = = 1 and (nk)=0 = 0 when k>nk > n (more or less).↩︎

May 14, 2024