logoalt Hacker News

leni536 • today at 8:14 PM • 2 replies • view on HN

Aren't there PRNGs that are designed so that they can be cheaply "forked" into "independent" generators without shared state? (For some value of "indpendent")


Replies

fc417fc802 • today at 8:39 PM

Yes, and that's exactly what's being described in the linked essay. They generally work by using a counter as state. Forking is typically implemented by incrementing the top bits while fetching the next number from a given stream is implemented by incrementing the bottom bits. Thus skipping forward and backward in a given stream is O( 1 ).

loeg • today at 10:01 PM

Basically all of them.