## Thursday, November 12, 2020

### [oxmhkwbb] Permutation distribution as fair d6

Roll a possibly loaded die 3 times.  Keep rolling until you get 3 distinct numbers.  Record the order in which you got those 3 numbers.

Note well that the same die must be rolled each time.  One may not (for example) roll 3 different dice simultaneously.  Each roll must be unfair the same way: independent and identically distributed (IID).

Assign the 3 numbers ranks: smallest, medium, largest.  The three ranks in the order that they appeared are some a permutation of (smallest, medium, largest).  There are 6 possible permutations of 3 distinct items.  Assign the 6 permutations the numbers 1 through 6.  This table could be memorized.

The output is uniform over 6 despite the input die possibly being unfair.  In this way, we have synthesized a fair (but slow) d6 from an unfair die.  Input die does not need to be d6; it could be anything equal to or larger than d3.

Variation possible with a d3: Roll once to get the first number.  Keep rolling until you get a number different from the first number.  The third number is now forced, so you don't need to roll for it.  This could be done with any die turned into a (possibly unfair) d3 by merging faces.

Update: the previous paragraph does not work.  It always needs to be three consecutive rolls of the die.  If a series of rolls, partial or complete, is bad (because of a repeated number), the entire series must be discarded.  One may not restart using the last number of the series.

Previously similar for d2.

The ordering of 4 distinct rolls yields a fair d24 (4 factorial), and 5 rolls yields a d120, which could be converted into a d10.  Is there an elegant mapping?  d120 also covers all the common dice types.  But 5 distinct rolls of a d6 will take a while.

Perhaps useful for officially drawing the winning numbers of a lottery.  Those machines are already set up to do consecutive draws without replacement (guaranteeing distinctness).  Even if the distribution of individual numbers is skewed (due to wear, mechanical imperfections), the permutation won't be.  But better still might be hashing closing stock prices.