Better HN
topnewbestaskshowjobs
Log inSign up

the_othernet

49 karma · joined May 5, 2025 (1y ago) · 16 submissions

Submissions

1.

biski64 – Fast C PRNG (.42ns), 2^64 Period, BigCrush/PractRand Pass(github.com ↗)

3 points · by the_othernet · 1y ago · discuss

comment 1y ago · link · parent

NOTE: I found a counterexample using Z3 Solver in which fast_loop maps to itself (0x5050a1e1d03b6432). A new version will be released with fast_loop and slow_loop as simple Weyl Sequences.

comment 1y ago · link · parent

What a great set of feedback. Thank you! I'll look at it as an acton item list.

And you are so right about being just one month in. Every time I think I'm starting to understand what's going on here, I realize the maze just keeps getting deeper.

comment 1y ago · link · parent

Using only 32bit fast_loop and mix (for 64bits of state) passes PractRand with 64bit output up to 256GB with only one unusual. That's about a 100 bit LCG equivalent? I did have to alter the output to be "(GR * mix) + fast_loop" and change the rotation constants to be 12 and 5.

comment 1y ago · link · parent

Added the Romu variants to benchmark.c. Here are the current results:

LoopMix128 ns/call: 0.380 ns

xoroshiro128++ ns/call: 0.757 ns

wyrand ns/call: 0.379 ns

PCG64 ns/call: 0.757 ns

RomuQuad ns/call: 0.575 ns

RomuDuoJr ns/call: 0.416 ns

comment 1y ago · link · parent

Using only 32bit fast_loop and mix (for 64bits of state) passes PractRand up to 256GB with only one unusual. That's about a 90 bit state LCG equivalent?

I did have to alter the output to be "(GR * mix) + fast_loop" and change the rotation constants to be 12 and 5.

comment 1y ago · link · parent

Super useful link. Thank you!

comment 1y ago · link · parent

I'll have to re-optimize the rotations for the smaller state size, but I will do it and report here.

comment 1y ago · link · parent

I wasn't able to analyze the cyclic behavior of the mix directly, but for the purpose of minimal period only fast_loop and slow_loop are used (as a 128bit counter).

comment 1y ago · link · parent

Hello! Awesome work on your hashing by the way!

When iterating I first tried to make fast_loop as random as possible by trying all possible rotational values and then having each option tested in PractRand 1000 times from 256M to 8GB. There was a wide range of performance by rotation. 47 was the best (for the GR constant) and resulted in the most tests being passed. The goal was a stronger than normal core for the PRNG that could feed actively into mix.

I found the multiplication to be necessary for passing PractRand and BigCrush with the state mixing as posted.

I had a variant which assigned mix as rotate(mix,constant) + (mix^fast_mix). That would pass cleanly with mix directly outputted (with no multiplication) - but I couldn’t get Z3 prover to show injectivity so I decided to go with the posted route.

comment 1y ago · link · parent

I have an offline poker app, and a user asked me what the algorithm was to generate the random numbers. That was a month ago. :)

comment 1y ago · link · parent

Just added to benchmark.c in the Github. Performance is comparable to xoroshiro128++.

comment 1y ago · link · parent

I just added PGC64 to benchmark.c in the Github. PCG64 speed looks to be about the same as xoroshiro128++.

14.

Show HN: LoopMix128 – Fast C PRNG (.46ns), 2^128 Period, BigCrush/PractRand Pass(github.com ↗)

76 points · by the_othernet · 1y ago · 34 comments

15.

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

5 points · by the_othernet · 1y ago · 1 comment