3

Is this possible?

I have a $6$ sided dice (call it a $d6$).

I want a way of getting an even distribution of the numbers $1$ to $50$ using that dice with no or minimal rerolls.

A way with a lot of rerolls.

A. Roll d6. $1 - 3 $means use table $A$, $4 - 6$ means use table $B$.

B. Table $A$ needs you to roll $2$ dice. First Dice gives you the column and second dice gives you the row. The numbers $1$ to $25$ are in the table, with the other $11$ spaces telling you to reroll. (Table B is similar, but with numbers $26$ to $50$).

The only problem with this is there are $22$ reroll spaces.

What I want is a way to get an even distribution, but with no rerolls or very few.

Not a Salmon Fish
  • 5,910
  • 2
  • 11
  • 31
Rewind
  • 167

2 Answers2

1

Rolling three dice gives you a number from $1$ to $216$. For a start, you can use the numbers $1-200$ and reroll the last $16$ but remember what the number is. Now one more roll gives you a number $1-96$ by multiplying your remembered number by $6$, subtracting the new roll, and adding $1$. You can use $1-50$ and reroll $46$ values. Again remember the remainder, roll again, and you get a number $1-6\cdot 46=1-276$. You can use $1-250$ and keep $1-26$. Keep going. This has to be optimal because you are using all the information you get. I haven't computed the average number of throws.

Ross Millikan
  • 383,099
  • To be closer to optimal, for the numbers $1$ to $200$ from the first three rolls you should get a number from $1$ to $50$ (for the first d$50$) and a number from $0$ to $3$ (or $1$ to $4$) which you then feed into the calculation of the next d$50$. – David K Jan 31 '21 at 17:02
  • I do use all of $1-200$, though I didn’t say to divide by $4$. You have $\frac {16}{216}$ left, which I use all of . You can’t reduce it to one of three evenly and that still will not guarantee termination. – Ross Millikan Jan 31 '21 at 17:19
  • 1
    I don't know what you mean by the last sentence--what is "it"? But I see that I am trying to solve a problem that was not asked, namely, to optimally generate a sequence of $50$-sided die rolls. For a single simulated roll I don't have any idea that is better than this answer. – David K Jan 31 '21 at 17:25
  • If I understood this right, I don't think this is optimal. $\log(50)/\log(6)=2.18$ while you are achiveing more than $3$ (actually: $3.11304$) Because, for example, when you get 200 you are only producing one of the 50 values, but your are wasting two bits - you are not using all the information you get. – leonbloy Jan 31 '21 at 22:48
  • @leonbloy: I thought the task was just to produce one random number. You can't do it with less than three rolls. Yes, if we are to produce more than one we can do better, as you say. – Ross Millikan Feb 01 '21 at 01:14
-1

Probably the best you can do is to convert any $3$ rolls to a number $1-50$ as follows : If the rolls give $a,b,c$ , then the number is $$36(a-1)+6(b-1)+c$$ If $a>2$ , then you can stop since the number must then exceed $50$, so you can ignore all trials where the first roll is more than $2$. If we have $a=2$ , the second roll is not allowed to exceed $3$, again you can save a roll if $3$ is exceeded.

Peter
  • 86,576
  • That works (+1). But on average, your method will require $6.84$ rolls to produce a random (uniformly distributed) integer between $1$ and $50$ inclusive, but Jean-Claude Arbaut's method requires only $3.24$ rolls on average. – quasi Jan 31 '21 at 12:18
  • @quasi How do you get $6.84$ rolls ? And yes, my goal was to optimize generating a single number. – Peter Jan 31 '21 at 12:47
  • As suggested in Jean-Claude Arbaut's comment:$;\mathbf (1);$Let $(a,b,c)$ be the result of $3$ independent rolls.$;\mathbf (2);$Compute $x=36(a-1)+6(b-1)+(c-1)$.$;\mathbf (3);$If $x > 199$, start over at step $1$, else return $(x;\text{mod};50)+1$. – quasi Jan 31 '21 at 13:06
  • With your method, if $e$ is the expected number of rolls, then $$ e= {\small{ \left(\frac{4}{6}{,\cdot,}(1+e)\right) +\left(\frac{1}{6}{,\cdot,}3\right) +\left(\frac{1}{6}{,\cdot,}\frac{3}{6}{,\cdot,}(2+e)\right) +\left(\frac{1}{6}{,\cdot,}\frac{2}{6}{,\cdot,}3\right) +\left(\frac{1}{6}{,\cdot,}\frac{1}{6}{,\cdot,}\frac{4}{6}{,\cdot,}(3+e)\right) +\left(\frac{1}{6}{,\cdot,}\frac{1}{6}{,\cdot,}\frac{2}{6}{,\cdot,}3\right) }} $$ which yields $e={\large{\frac{171}{25}}}=6.84$. – quasi Jan 31 '21 at 13:42
  • What about that : Since the first roll must be $1$ or $2$ anyway, we instead assign $1$ if the first roll is odd and $2$ , if the first roll is even and take this as $a$. So, we need not wait until $1$ or $2$ appears. This should decrease the expected number of rolls drastically. – Peter Jan 31 '21 at 13:51
  • Yes, that revision would yield $e={\large{\frac{99}{25}}}=3.96$, much better, but still not optimal. – quasi Jan 31 '21 at 15:06