Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

71% Positive

Analyzed from 383 words in the discussion.

Trending Topics

#simulation#stochastic#random#https#non#quality#sort#org#xorshift#generators

Discussion (16 Comments)Read Original on HackerNews

AlanZucconiabout 2 hours ago
I'm really curious... How did you manage to post this link before I did?
tobrabout 2 hours ago
I have your feed in my RSS reader! This seemed like something HN would be interested in.
AlanZucconiabout 1 hour ago
I should be faster next time then: my entry got tagged as [dupe] ahah! Also: I somehow got 10x the usual amount of traffic today, and my website is sort of on fire!
chrisjjabout 1 hour ago
... and currently nonresponsive.
smusamashah6 minutes ago
> No multiplications. No divisions. No lookup tables. Just a few bitwise instructions.

Would have appreciated this article more if it was written by a human.

delducaabout 4 hours ago
I’ve replaced Lua’s random by this. I’ve posted about it here https://nullonerror.org/2025/08/02/replacing-lua-s-math-rand...
saithoundabout 3 hours ago
Ah yes, Xorshift, the RANDU [1] of the 21st century [2].

There is no real use case for better non-CS generators, as explained by adrian_b back in 2021 [3].

[1] https://en.wikipedia.org/wiki/RANDU [2] https://arxiv.org/abs/1908.10020 [3] https://news.ycombinator.com/item?id=28886698

moregristabout 2 hours ago
I’m not sure what point you’re trying to make, exactly, but a use case for better non-CS generators has always been stochastic simulation, especially simulation/sampling approaches that are bound by the number and quality of uniform variates per second.

As someone who has spent considerable time working in these areas, I still appreciate advances.

saithoundabout 1 hour ago
> I’m not sure what point you’re trying to make,

Have you skimmed the linked thread?

> especially simulation/sampling approaches that are bound by the number and quality of uniform variates per second

Sorry, nobody does stochastic simulations where the number of uniform random numbers obtained per second is any sort of bottleneck. If you've spent considerable time on stochastic simulation, you already know this.

But even if you insist that you alone are doing some very weird stochastic simulation which is somehow bottlenecked on sourcing random numbers fast enough, the falling in planes phenomenon linked above would make xorshift-type generators a poor choice for most sorts of simulations. It introduces spatial correlations into any sort of lattice dynamics simulation (Ising model, percolation) and every high dimensional Monte Carlo integration. Beyond falling in the planes, since xorshift is linear over GF(2), it is also a particularly bad choice for nondeterministic cellular automata and Boolean dynamical systems which use parity, bit masks, or xors.

AES-CTR throughput on a modern CPU is higher than that of xoshiro256++, and much higher quality. No advances in non-CS PRNGs can beat that while maintaining the same quality. If your stochastic simulation is bottlenecked on random bits, CSPRNGs are still the way to go, and they don't interact in nasty ways with any dynamical system you can actually sinulate quickly.

dgacmuabout 1 hour ago
This is a very weird hill to die on.

I do a lot of testing and designing of things like hash tables and filters, and having a really fast, non-CS generator is incredibly useful for being able to clearly identify performance bottlenecks in designs. PCG has been spectacularly useful for that purpose for me.