dice random

How dicey are your dice?

Few people think this topic is worth considering or write about. Even among developers who make games with the dice very few spend more than a minute thinking about realistic dice implementation from statistical point of view. Some do not think at all and just provide the user with a random value between 2 and 12 for 2 dice rolls – which cannot be further from the truth. Starting from the worst mistakes and most known (and, as a result, less common in the apps) and going towards issues rarely thought of by anybody at all, here is our list:

  • Just return a random number between 2 and 12, then show 2 dice with values sum of which gives the result of the random number received. With this approach, there is the same chance of getting 2 or 12 as with getting 7 or 8. However, with real dice one can get 2 only by getting 1 on each die, which is quite rare (1/6 * 1/6 to be precise, or 1/36 i.e. less than 3% of all rolls). Chance to get 7 on the other hand is whooping 17%, so by rolling the dice continuously the chance to get 7 is 6 times higher than getting 2
  • Return 2 random numbers between 1 and 6. Depending on the programming language and random function implementation, statistically this approach is quite good. However, it lacks the visibility of how this result was achieved, you could easily be accused of “cheating” and generating numbers which suit your agenda rather than being truly random
  • Display a series of 2 random 1 to 6 numbers with decreasing speed of change, eventually stopping at some numbers. It would emulate the rolling of the dice. Problems: die cannot roll from a given side to every possible side in reality
  • Same as above, but for every consequent “roll” exclude the current side and the opposite side (die must turn on its side). So out of any position each die might have only 4 possible values instead of 6
  • Consider that the die cannot move backwards. I.e. after getting 3, then 5, die cannot get 3 again. It could only roll forward or on either side. That limits each consequent roll to only 3 possible sides
  • Make the “speed of rolling”, i.e. the frequency of the sides being changed independent for each die and random to a certain extent. Each die might come to a stop at a different time too

Still believe the dice are simple?