Why 23, 17, and 26? The Magic Numbers Behind Xorshift Randomness

Xorshift Generators

Why 23, 17, and 26? The Magic Numbers Behind Xorshift Randomness

This deep dive into xorshift generators, the algorithm behind countless games and simulations, explores why specific shift values like 13, 17, and 5 are special. It explains how these three lines of code can generate over four billion unique numbers, the concept of maximal triplets, and why some shift combinations fail. The article also corrects errors in Marsaglia's original paper and discusses variants and canonical triplets.

These constants might be arbitrary, but they’re never random.

More from this day

2026-08-15