frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: DualMix128 – A fast, simple PRNG passing PractRand (32TB) and BigCrush

https://github.com/the-othernet/DualMix128
5•the_othernet•2mo ago
Hi HN,

I'd like to share DualMix128, a pseudo-random number generator I developed. It's written in C and achieves very high speed while maintaining strong statistical properties for non-cryptographic use.

GitHub (MIT License): https://github.com/the-othernet/DualMix128

Key points:

* *Fast:* Benchmarked at ~0.36 ns per 64-bit generation on GCC 11.4 (-O3 -march=native). This was over 2x faster than `xoroshiro128++` (~0.74 ns) and competitive with `wyrand` (~0.36 ns) in the same tests. (Benchmark code/results in repo).

* *Robust:* Passes the full TestU01 BigCrush suite and PractRand up to 32TB with no anomalies reported. (Test harnesses/logs in repo).

* *Simple Algorithm:* Uses a 128-bit state (two `uint64_t`) with simple mixing based on addition, XOR, rotation, and a final multiplication by the golden ratio constant.

* *C Implementation:* Minimal dependencies (`stdint.h` for core), straightforward C code.

This came out of exploring simple constructions for efficient PRNGs that still hold up under heavy statistical testing.

Curious to hear feedback on the design, performance, potential applications, or any weaknesses you might spot. Thanks!

Comments

thomaskoopman•2mo ago
Very cool, fast and looks like it should vectorize too. Do you have a jump function for parallel seeding?

How did you come up with this, some number-theoretic basis or more experimental?