Simulate a 12-sided fair die with a 10-sided fair die 
If I have a single 10-sided fair die and I want to simulate a 12-sided fair die, what would be the most efficient way to do so? 

Thus, we have to ensure that the likelihood of each result is equally likely.
 A: Let the faces be labelled $0,\ldots,9$. Repeatedly roll the die $m$ times to form a decimal $\alpha=0.a_1a_2a_3\ldots a_m$ and say that the outcome is $\lfloor 12\alpha\rfloor$.
The challenge is to make $m$ as small as possible. To do so, stop as soon as $\alpha\le x<\alpha+10^{-m}$ implies $\lfloor 12x\rfloor =\lfloor 12\alpha\rfloor$.
A: You could simulate a 12-sided die by rolling multiple times. Since $12 = 2 \cdot 2 \cdot 3$, you could do the following:


*

*Throw a first time, result $r_1$ modulo 2. Throw a second time, result $r_2$ modulo 2. Throw a third time until you don't hit a 10, result $r_3$ modulo 3. Then set the result $r = 6 r_1 + 3 r_2 + r_3 + 1$. The expected number of rolls equals $2 + \frac{10}{9} \approx 3.11$.

*Throw a first time until you don't hit a 7, 8, 9 or 10, result $r_1$ modulo 6. Throw a second time, result $r_2$ modulo 2. Then set the result $r = 2 r_1 + r_2 + 1$. The expected number of rolls equals $\frac{10}{6} + 1 \approx 2.67$.

*Throw a first time until you don't hit a 9 or 10, result $r_1$ modulo 4. Throw a second time until you don't hit a 10, result $r_2$ modulo 3. Then set the result $r = 3 r_1 + r_2 + 1$. The expected number of rolls equals $\frac{10}{8} + \frac{10}{9} \approx 2.36$.
