Re:Should random() be banned?
by MauranKilom on Thursday February 11, 2021 @07:45PM
(#26109537)
> You can have something that has better randomness, runs several times faster, uses less space and has a much more compact and simple implementation.
Could you share at least one example of such a generator?
Most of these aspects are trivial to improve on, but having "better randomness" on top is quite the bar.
Re:Should random() be banned?
by ChrisLomont on Thursday February 11, 2021 @08:35PM
(#26109852)
The PCG class of PRNGs are very good, and have a zillion tunable versions to suit every need.
Re:Should random() be banned?
by sobriquet9 on Thursday February 11, 2021 @10:09PM
(#26110359)
MCG 128 from http://www.pcg-random.org/posts/on-vignas-pcg-critique.html or xoshiro256plus from http://prng.di.unimi.it/xoshiro256plus.c
https://en.wikipedia.org/wiki/Mersenne_Twister#Alternatives
https://nullprogram.com/blog/2017/09/21/
I don't think better randomness than MT is as high a bar as you make it out to be, both links above also briefly mention statistical shortcomings of MT.
Doesn't FreeBSD use Mersenne Twister as its CSRNG?
No, FreeBSD uses Fortuna https://en.wikipedia.org/wiki/Fortuna_(PRNG)
Mersenne Twister is not secure, and it isn’t a very good RNG even for insecure uses.
So given that Mersenne Twister sucks in pretty much every possible way other than having a catchy name, likely the sole source of its continued popularity, its probably not a good choice for replacing some "default" random number generator with something better.