FurryGuy wrote: |
---|
I've mentioned the shortcomings of the C library PRNG routines when replying to more than a few questions and got stomped on by some people, long time posters with more C++ experience than I have, saying the C random routines are "good enough for trivial purposes." |
Alas, this is a common defect in the collective consciousness of C and C++ programmers.
The reality is that relatively few people actually
understand how random numbers really work, especially when it comes to initialization and CSPRNGs. For most programmers it is a magical black box, even for those who have been around for a while—
And the reason is...
it is because that is how they have been taught!
(Either by formal schooling or by other big egos who have told them the same crap when
they asked about RNGs.)
They wrote: |
---|
good enough for trivial purposes |
Technically true,
maybe, but what is a “trivial purpose”?
If you can name anything except simple video games and MyFirstProgram™, you are probably ahead of the game in understanding the relative uselessness of
rand().
The sad thing is, there really isn’t a whole lot to learn about high-quality random numbers. A good, inexhaustible CSPRNG is actually pretty easy* to create, so long as you make sure to cross your 'T's and dot your 'I's.
*
Don’t confuse easy for just a few lines of code. The actual effort is rather involved. But, that said, you would still surprised how short and simple powerful TPRNG → STRNG → CSPRNG systems are.
And the best part of it all? Modern operating systems do all the hard work for you!
Hence the reason for my (
CSPRNG Library|
https://github.com/Duthomhas/CSPRNG)
/shameless plug
It makes using high-quality random numbers in C and C++ stupidly easy.
In any case, it is long past time to begin teaching C++’s random number capabilities over something people like because it is short and brain-off required.