A new pseudo-random number generator called LoopMix128 has sparked interesting technical discussions among algorithm experts, with the creator's journey beginning from an unexpected source: a user question about a poker app's randomization method.
The algorithm, designed for non-cryptographic applications where speed and statistical quality are paramount, boasts impressive features including a guaranteed period of 2^128, proven injectivity, and clean passes in both BigCrush and PractRand testing suites up to 32TB of data.
Performance Claims and Expert Analysis
LoopMix128 claims significant performance advantages, reportedly running 8.75 times faster than Java's random implementation and outperforming other modern high-speed PRNGs like xoroshiro128++ and PCG64. However, these claims have prompted technical scrutiny from algorithm experts, including the creator of MurmurHash.
One expert expressed surprise that the algorithm passes rigorous statistical tests given its relatively simple design, noting that the state update function is barely nonlinear and the output derivation is linear. This sparked a technical exchange about the algorithm's design choices, with the creator explaining how rotational values were carefully selected through extensive testing to optimize randomness quality.
While I don't doubt this passes BigCrush etc, I do find it very surprising that it does. The state update function is effectively a = rotate(a, constant) + b; b = rotate(b, constant) + constant; and the output derivation is output = (a + b) * constant.
LoopMix128 Key Features
- Performance: 8.75x faster than Java random, 21% faster than Java xoroshiro128++, 98% faster than C xoroshiro128++ and PCG64
- Statistical Quality: Passed TestU01's BigCrush suite and PractRand (up to 32TB) with zero anomalies
- Period: Guaranteed minimum period length of 2^128
- State Size: 192-bit state with proven injectivity
- PractRand Comparison (1000 runs from 256M to 8GB with varied seeds):
- LoopMix128: 0 failures, 24 suspicious
- xoroshiro256++: 0 failures, 27 suspicious
- xoroshiro128++: 0 failures, 28 suspicious
- wyrand: 0 failures, 32 suspicious
- /dev/urandom: 0 failures, 37 suspicious
State Size and Statistical Quality
An interesting discussion emerged around state-size capacity analysis, with one commenter suggesting that the algorithm's 192-bit state might be unnecessarily large. They pointed out that even known poor algorithms like middle square can pass statistical tests with such a large state, referencing PCG's analysis methodology of reducing state size until failure to determine how much safety margin an algorithm has.
The creator responded positively to this suggestion, later reporting that a reduced version using only 32-bit variables (for 64 bits of state) still passed PractRand up to 256GB with only one unusual result, suggesting the algorithm has substantial robustness even with significantly reduced state.
Real-World Applications
The community discussion revealed several practical applications for high-performance PRNGs. Graphics and audio programming were highlighted as domains where PRNG performance can be a measurable fraction of total program performance without security constraints. When generating noise for every audio sample or pixel, extremely fast algorithms provide tangible benefits. Monte Carlo simulations were also mentioned as an obvious use case.
The creator's journey into PRNG development began with a simple question about randomization in a poker app, demonstrating how curiosity-driven exploration can lead to meaningful technical contributions. While some questioned why the creator didn't implement established cryptographic algorithms like ChaCha for a poker application, the resulting deep dive produced an algorithm with potential applications beyond its original context.
As computing increasingly relies on randomization techniques across various domains, from gaming to scientific simulations, the continued refinement of PRNGs like LoopMix128 represents an important area of algorithmic development where even modest improvements can have widespread impact.