0

I'm wondering if it's possible to simulate a d20 using smaller dice, and if so, how would one figure out how many you would need?

This question provides an algorithm to do so using 2 coins with p = 1/2 and p = 1/n, but is there an algorithm that would work for multiple like dice of the same probability? eg. can you find an x such that if you roll x 6 sided dice you are left with exactly 20 distinct outcomes?

  • 3
    If you have fair dice with sides $d_1,d_2,\cdots ,d_n$ then the only way to get $20$ equally likely results is if $d_1d_2\cdots d_n$ is divisible by $20.$ In particular, one of the die must have a number of sides a multiple of $5.$ – Thomas Andrews Aug 01 '19 at 19:33
  • Well, with a ten sided die you can toss it once to determine if you are in $(1,\cdots, 10)$ or $(11,\cdots, 20)$ and then again to determine where you are in that collection. Similarly you can toss a five sided die four times, and so on. – lulu Aug 01 '19 at 19:33
  • You can combine a single d5 and d4 using the Chinese remainder theorem. Or, more simply, if $x$ is a uniformly distributed rv on ${0,1,2,3,4}$ and $y$ a uniformly distributed rv from ${0,1,2,3}$, then $5y+x$ has a uniform distribution over ${0,1,\ldots,19}$. Subtract/add one, if the range is off by one. – Jyrki Lahtonen Aug 01 '19 at 19:46
  • 1
    A bit off topic, but I remember Matt Parker posing the challenge problem of simulating a roll of two six-sided dice using three indistinguishable six-sided dice. – JMoravitz Aug 01 '19 at 19:53
  • In regards to lulu's comment, this is actually very standard practice. In tabletop games it is common to not own a 100-sided die (I do have one in my collection, but it is so close to spherical that it rolls for a very long time) and to instead use two 10-sided dice to simulate a 100-sided die. The first 10-sided die will represent the tens-digit while the second 10-sided die will represent the ones-digit. See percentile dice on wikipedia. – JMoravitz Aug 01 '19 at 19:55
  • @lulu Sorry, can you flesh out your idea the 5sided die case? The only thing I can think of at the moment is that the first roll determines if you are in 1-4, 5-8, 9-12,13-16,17-20. – Keshav Aug 01 '19 at 20:02
  • I think this question has the most comprehensive answers for a $10$ sided dice. It surely can be adapted to a $20$ sided dice.https://math.stackexchange.com/questions/1314460/how-to-generate-a-random-number-between-1-and-10-with-a-six-sided-die?noredirect=1&lq=1 – zwim Aug 01 '19 at 20:34
  • @Keshav Yes, you're right. It doesn't work as smoothly for a five sided die as I thought. – lulu Aug 01 '19 at 21:05
  • @JyrkiLahtonen is there a general form of your Chinese remainder theorem result for generating a uniform distribution over {0, 1, ..., c} from a function of uniform rv's from {0,1,...,a} and {0,1,..,b} where a<c and b<c? – Mark A Johnson Dec 13 '20 at 13:41
  • @MarkAJohnson On second thought the use of Chinese remainder theorem was quite unnecessary. Just use the formula $(b+1)x+y$ if $x\in{0,1,2,\ldots,a}$ and $b\in{0,1,\ldots,b}$. You get $N=(a+1)(b+1)$ alternative outcomes. If $m$ is any factor of $N$, then taking the result modulo $m$ still gives equally likely outcomes. – Jyrki Lahtonen Dec 13 '20 at 16:13
  • Related: [How to generate a random number between 1 and 10 with a six-sided die?(]https://math.stackexchange.com/questions/1314460/how-to-generate-a-random-number-between-1-and-10-with-a-six-sided-die) – MJD May 15 '21 at 16:18

2 Answers2

3

If you aim for a fixed number $x$ of dice, I agree with the comment of Thomas Andrews that the product of the numbers of their sides has to be a multiple of $20$. However, if the number $x$ may vary, then this algorithm provides a solution:

  1. Roll a 6-sided die with outcome $\omega_1$. Set $a_1=0$, if $\omega_1\in\{1,2,3\}$, and $a_1=10$ otherwise.

  2. Roll a 6-sided die with outcome $\omega_2$. Set $a_2=0$, if $\omega_2\in\{1,2,3\}$, and $a_2=5$ otherwise.

  3. Roll a 6-sided die with outcome $\omega_3$. Set $a_3=\omega_3$, if $\omega_3\in\{1,2,3,4,5\}$. If $\omega_3 = 6$ repeat step 3.

Eventually, the algorithm will terminate and $a = a_1 + a_2 + a_3$ will be uniformly distributed in $\{1,\dots,20\}$.

IljaKlebanov
  • 1,797
0

For what it's worth, you can use a single $(6)$ sided die (or one red die and one green one) to fairly simulate a $(19)$ sided die, as follows:

Roll the die until you get a number less than $(6)$. Denote the satisfying roll as $(r_1)$. Then roll the die again until you get less than $(5)$. Denote this roll as $(r_2)$. Then compute $T_1 = [4 \times (r_1 - 1)] + (r_2)$. As has already been discussed, $T_1$ is equally likely to be assigned any of the numbers in $\{1,2,\cdots, 20\}.$

Now, repeat the exact same procedure, computing $T_2$. If $T_2 = T_1$, reject $T_2$ and compute $T_2$ from scratch. Finally, once $T_2 \neq T_1$, for $T_2 > T_1$, set $T_2 = T_2 - 1.$

Note that the objection that it theoretically could take an unbounded number of rolls until $T_2$ is determined also applies to the original procedure of emulating a $(20)$ sided die. That is, it theoretically could take an unbounded number of rolls until you roll $< (6)$.

To verify that this procedure works, the case of $T_1 = 1$ or $T_1 = 20$ is trivial.

Consider 1 < $T_1 < 20$. Then, consider the computation of $T_2$, once $T_2 \neq T_1$, and before $T_2$ is adjusted to ($T_2 - 1 ~:~$ if necessary). The $(19)$ possible values of $T_2$ represented by $\{1,\cdots, (T_1 - 1), (T_1 + 1), \cdots, 20\}$ are equally likely. This is because $T_1$ was computed at random.

Then, the final computation of $T_2$ will be represented by shifting $\{(T_1 + 1), \cdots, 20\}$ down $(1)$ if the unadjusted value of $T_2$ happened to be $> T_1$.

user2661923
  • 35,619
  • 3
  • 17
  • 39