News for hackers. Stuff that matters.
Re:Specific Problems with Other RNGs by cwmma on Wednesday November 11, 2015 @09:00AM (#10546663)
the knocks against the openbsd arc4random, namely

> No facility for a user-provided seed, preventing programs from getting reproducible results

> Periodically “stirs” the generator using kernel-provided entropy; this code must be removed if reproducible results desired (in testing its speed, I deleted this code)

seem like exactly the kinds of foot guns you really want removed from an RNG you're using for real live code.

Re:Specific Problems with Other RNGs by kryptiskt on Wednesday November 11, 2015 @09:29AM (#10546800)
Sometimes you want well-mixed numbers, but in a sequence that you can rerun. If you are simulating a process or testing games, having a fully deterministic setup if you know a seed is a great help to reproduce unusual behavior sighted.
Re:Specific Problems with Other RNGs by DanBC on Wednesday November 11, 2015 @09:03AM (#10546672)
Some people need reproducible "randomness". They're testing a model, for example. I'm not sure if this RNG is good for them or not.
Re:Specific Problems with Other RNGs by tedunangst on Wednesday November 11, 2015 @11:24AM (#10547412)
Some people seem forever confused about the difference between random and deterministic.
Re:Specific Problems with Other RNGs by Veedrac on Wednesday November 11, 2015 @04:41PM (#10549530)
Reproducibility and seed-ability isn't a footgun unless it's easy to do wrong accidentally, or hard to do right accidentally.

The former really isn't a problem except for really poor APIs, and the later isn't made worse by it... although the PCG random author does like to make a point of just how bad it is in C++ (see [1]).

[1] https://www.reddit.com/r/cpp/comments/31857s/random_number_g...

Re:Specific Problems with Other RNGs by thrownaway2424 on Wednesday November 11, 2015 @10:32AM (#10547103)
What about unit tests?
Re:Specific Problems with Other RNGs by dspillett on Wednesday November 11, 2015 @11:07AM (#10547307)
Produce a set of random numbers once and store them as part of the test set. That way your test is independent of the black box which is your RNG. Or make your own simple RNG - in these cases you are looking for "arbitrary, definitely not just sequential" rather than cryptographically random (or, indeed, truly random at all).

If you rely on the order of the output, for reliably consistent test cases in this instance, avoid using black-box RNGs which could change implementation under your nose without much or any warning.

Re:Specific Problems with Other RNGs by Veedrac on Wednesday November 11, 2015 @04:44PM (#10549553)
Cryptographically random isn't the aim here - pseudorandom is.

A seedable black-box RNG that guarantees what seed corresponds to what stream is way simpler to use than a list of random numbers, IMHO. It's the difference between copying one number and copying a million.

Re:Specific Problems with Other RNGs by dspillett on Thursday November 12, 2015 @04:55AM (#10552199)
> Cryptographically random isn't the aim here

We are agreeing here.

> A seedable black-box RNG that guarantees what seed corresponds

If you can control when the blackbox gets updated, or the blackbox carries a guarantee of stable output for any given seed over the while time of its existence, yes. But if you are using OS provided RNGs, as a for instance, their behaviour is not defined (well they are, but those definitions are not set in stone) and may change as kernel updates happen.

That is why I suggest "making your own simple PRNG". This could be as simple as picking a known documented algorithm as implemented by a particular library and using that in your test cases - it doesn't need to be as much as writing your own function even.

Re:Specific Problems with Other RNGs by Veedrac on Thursday November 12, 2015 @06:33AM (#10552540)
Right... but nobody's suggesting replacing the OS's RNG.