Fair Die Roller

The fair die roller works by adjusting the probability table for each roll of the dice, based on the number of times each result has come up compared to how many times it 'should' have come up. The fair die roller is useful anytime you need a random roll, but want the distribution of outcomes to match the expected distribution even though the number of rolls is small.


In some games, one player receives more benefit from a particular roll than the others players. In this case, it would be nice if the number of times each result is rolled in the game is close to the distribution that would be expected if there were a large number of rolls. But if the game is short, the actual distribution of rolls can be very different from the expected distribution. The fair die roller will force the actual distribution to be closer to the expected distribution, even for a small number of rolls.


Since the probability of each result is changed for each roll, the players can take advantage of that knowledge to 'game' the dice.

Comparison to existing systems

In traditional games, a 'random' outcome is most often generated with dice, but some games use a deck of cards, and others will place each outcome in a hat and draw from the hat with or without replacement.


For any set of dice, there is a set probability of each of the unique results. For a single six sided die, there is a 1/6 chance of rolling each number. If you roll two six sided dice, there are 12 possible outcomes and the probability of each looks like this:

For a normal die, each roll uses the same probability table regardless of what outcomes have already occurred. So rolling one '7' doesn't reduce the probability of rolling another '7'.

Drawing without replacement

Using a hat or a deck are ways of drawing from the set of outcomes without replacement. You could imagine putting the numbers one through six in a hat and then drawing them out one at a time. Now, the probability of an outcome is adjusted by the previous draws. If we have already drawn the '2', and '3', the odds of drawing a '2' are 0% and the odds of drawing a '1' are 1/4.

You could also imagine using multiple copies of each number in the hat, or a deck of cards where only the number is important. With that system, the odds of a second '2' are lower, but not zero. By shuffling the deck before it is exhausted you can ensure that there is always some uncertainty in the next result, but if you have drawn all the aces, you can be sure of not seeing another ace until the next shuffle.

How it works

The fair die roller simply adjusts the probability table before each roll based on the previous rolls. In this way you get the advantages of using a deck or hat without ever knowing that a particular outcome is impossible.

The fair die roller starts by using the normal probability distribution for the requested set of dice. After each roll, the outcome is tabulated and the probability table adjusted. The new probability is given by the following formula:

P=Po * 2-error*tightness

Where: Po is the original probability, error=count-Po*numRolls, and tightness is a user defined constant that determines how aggressively the probabilities are adjusted.

Once the new probabilities have been calculated, they are re-normalized such that the sum of the probabilities for all the possible outcomes is still one.


The amount that the probability is adjusted depends on the "tightness" setting. A tightness of 0 makes the rolls purely random. A tightness of infinity is like putting all the numbers into a hat and drawing them out. If the tightness is 1, the odds of rolling a number a second time are reduced by about 50%, while a tightness of 2 reduces the odds by about 75%.


As an example, lets say that we are rolling two six sided dice. The base probability table is shown above. Lets say that our first four rolls are 2,4,7,7. We can calculate the new probabilities using the above formula. We will start with a tightness of 1.0. The result is shown below.

If instead we use a tightness of 0.5, the probabilities are adjusted less, making the rolls more random.
A tightness of 5.0 will make the roller adjust the probabilities more.