By: Jörn Engel (joern.delete@this.purestorage.com), March 25, 2022 9:30 pm
Room: Moderated Discussions
hobold (hobold.delete@this.vectorizer.org) on March 25, 2022 2:34 pm wrote:
> Adrian (a.delete@this.acm.org) on March 25, 2022 9:37 am wrote:
>
> [...]
> > However well-designed PRNGs do not introduce any global state.
>
> There is a style of PRNG that is essentially stateless. For example Squirrel3:
>
> https://maartene.github.io/blog/files/4550a51525c9c2a44d04ac24761e9f71-24.html
>
> In its simplest form this is essentially a hash function that turns a given running index 0 .. N
Err. hash(counter++) is a decent PRNG, assuming your hash is decent as well. But that isn't exactly stateless. Your state is the counter.
And you can do slightly better if you increment the counter by a large odd number instead of 1. Basically, that allows you to weaken the hash function a little bit without compromising the PRNG quality.
> Adrian (a.delete@this.acm.org) on March 25, 2022 9:37 am wrote:
>
> [...]
> > However well-designed PRNGs do not introduce any global state.
>
> There is a style of PRNG that is essentially stateless. For example Squirrel3:
>
> https://maartene.github.io/blog/files/4550a51525c9c2a44d04ac24761e9f71-24.html
>
> In its simplest form this is essentially a hash function that turns a given running index 0 .. N
Err. hash(counter++) is a decent PRNG, assuming your hash is decent as well. But that isn't exactly stateless. Your state is the counter.
And you can do slightly better if you increment the counter by a large odd number instead of 1. Basically, that allows you to weaken the hash function a little bit without compromising the PRNG quality.