How to replace 8-sided dice with other dice

We need to not only generate numbers between 1 and 8, but also to make sure they are uniformly distributed.

Your solution does not produce uniformly distributed results (at least according to MJD, in the comments).

However, this procedure does: you can roll a 4-sided die for a value between 1 and 4, and then toss a coin: if heads, add 4 to the result.

It is easy to see that each number from 1 to 8 is produced by exactly one outcome: for example, a result of 3 requires a roll of 3 and a toss of tails, while a result of 5 requires a roll of 1 and a toss of heads.


There are essentially three basic ways to generate a number from $\{1\dots k\}$ for $k\ne n$ with an $n$-sided die that preserves the uniform probability of all results:

  • Truncation: if $k\lt n$, you can simply ignore (reroll) results greater than $k$
  • Division: if $n=mk$ for some integer $m$, you can designate $m$ different results as giving a result $i$ for $1\le i\le k$ (i.e. to simulate a $3$-sided die with a $6$-sided die, you can designate $\{1,2\}\rightarrow 1$, $\{3,4\}\rightarrow 2$ and $\{5,6\}\rightarrow 3$)
  • Exponentiation: if $k=n^m$ for some integer $m$ you can roll the die $m$ times, interpreting the results as the digits of an $m$-digit integer in base $n$ (and interpreting a result of $n$ as $0$, and a string of all $0$'s as $k$) Example: percentile dice

Any combination of these can be used, thus for instance you could simulate an $8$-sided die with a $6\text{-sided}$ die by exponentiation by 2 (simulating a $36$-sided die) followed by division by 4 (simulating a $9$-sided die) followed by truncation to $8$. Since you have multiple dice to start with, more solutions are possible, but you only ever need one die. For instance you could simulate an $n\text{-sided}$ die for any $n$ with just a coin using exponentiation (generating binary strings with head $\rightarrow 1$ and tail $\rightarrow 0$) and truncation (rerolling results greater than $n$), and going the other way, you can simulate a coin with an $n$-sided die for any $n\ge 2$ by truncation to an even number (if $n$ is odd), followed by division to $2$.

If you have multiple die sizes, exponentiation can be generalized to multiplication (as is used in the accepted answer): if $k=mn$, and you have dice of sizes $m$ and $n$, you can roll the $n$-sided die (interpreting a result of $n$ as $0$) and add $n$ times the result of rolling the $m$-sided die (interpreting $m$ as $0$), and interpret $0$ as $k$. In the accepted answer $n=4$, $m=2$ and $k=8$, but an alternate solution would use $n=2$ and $m=4$ so you could (for instance) roll the $4$-sided die (interpreting $4$ as 0), multiply the result by $2$ then add $1$ if you flip heads, and interpret an overall result of $0$ (that is $[4,\text{tails}]$) as $8$. It's equivalent (and simpler) to multiply the $\text{d}4$ result by $2$ and subtract $1$ if you flip tails.


Roll the D10 and if you roll 9 or 10, re-roll it. It's easy to remember and easy to do. And it gives uniform results.


I'm assuming that all dice (counting the coin as 2-sided die) are rolled in parallel, and rerolls are not allowed. I'll use the standard notation D$n$ for an $n$-sided die (D2 for the coin).

Since we have to simulate a D8, which is a power of 2, we need to multiply uniform distributions with powers of 2; we can consider them as random bits.

  • The D2 delivers one random bit.

  • Each D4 delivers two random bits.

  • The D10 delivers only one random bit, as 2 is the highest power of 2 that divides 10. Since rerolls are not allowed, the factor 5 is useless for generating uniform distributions for powers of 2.

So we have 6 bits in total, of which we can select arbitrary 3 to generate a single D8 roll.

For example, you can use one D4 (2 bits) and the D2 (1 bit) to get 3 bits (this is the solution other answers gave).

You can also take both D4s, and use only one bit for one of them, for example by adding 4 to the result of the second D4 if the first D4 gives an odd result.

Or you could select arbitrary 3 dice, and take their bit value as 0 if the roll result is even and 1 if the result is odd, and then from the three bits form $4a+2b+c+1$ where $a$, $b$ and $c$ are the bits derived from the three dice.

Indeed, you could use the four given dice to simulate rolling two D8 in parallel!


Let the following denote:

  • $a$: the value of the $10$-sided die , i.e., $a\in[1,10]$
  • $b$: the value of the 1st $4$-sided die, i.e., $b\in[1,4]$
  • $c$: the value of the 2nd $4$-sided die, i.e., $c\in[1,4]$
  • $d$: the value of the $2$-sided coin , i.e., $d\in[1,2]$

Then the value of the $8$-sided die as a function of the above variables is:

$$f(a,b,c,d)=[32(a-1)+8(b-1)+2(c-1)+(d-1)]\bmod8+1$$


Here is a short Python script which confirms uniform distribution:

dict = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}

for a in range(1,10+1):
    for b in range(1,4+1):
        for c in range(1,4+1):
            for d in range(1,2+1):
                dict[(32*(a-1)+8*(b-1)+2*(c-1)+(d-1))%8+1] += 1

print dict

The output is {1: 40, 2: 40, 3: 40, 4: 40, 5: 40, 6: 40, 7: 40, 8: 40}.