Home/Glossary/Modulo bias

Glossary · Probability

Modulo bias

Modulo bias is the small skew introduced when a random integer from a wide range is reduced with the remainder operator to a smaller range that does not divide the wide range evenly, favouring the low outcomes.

Modulo bias, in full

Category
Probability
Also called
Modulo skew, Remainder bias
In the glossary
All 75 terms, A–Z

A worked example

The same idea with real numbers attached.

A generator returning 0 to 9 uniformly, reduced by x % 3 and mapped to faces 1, 2, 3. Inputs 0, 3, 6, 9 give face 1. Inputs 1, 4, 7 give face 2. Inputs 2, 5, 8 give face 3. Over 10,000 rolls expect about 4,000 ones against 3,000 twos and 3,000 threes. Reject the input 9 first and nine inputs survive, three per face, so the counts flatten to about 3,333 each.

Sources

Every dated or checkable claim above, with where it came from.

See also

The terms that sit closest to this one.

Where it comes up on this site

Modulo bias: frequently asked

It depends entirely on the ratio between the two ranges. Squeezing ten inputs down to three outcomes gives 40 percent against 30 and 30, which is enormous and would be obvious in a few hundred rolls. Squeezing a full 32-bit value down to six gives an excess of roughly one part in 716 million, which no amount of play at a table would ever reveal. Both are the same defect. Only one of them matters in practice, and both are removed the same way.

The low ones. Leftover values at the top of the source range land on the smallest remainders, so those outcomes pick up one extra input each.

No. They reject the leftover values rather than taking a plain remainder.

More probability terms

The rest of the vocabulary

Lottery mechanics, probability, numerology and astrology, defined in one A–Z.

Open the glossary