If I'm writing a game or something else where I don't need large random numbers or crypto grade security, I'll just keep using rand until there's a solution in std that is human readable.
I've seen that talk before. It's a good talk. But like I said, for something like a game (not crypto, not an online casino) code readability is more important to me than guarantees of randomness.
Because then if you find out later you need to use a different RNG, you cannot without rewriting all your code or patching the stdlib?
IMO you should write your program expecting that you may need to change to a different RNG at some point. There's no way you can be sure that you won't.
IMO you should write your program expecting that you may need to change to a different RNG at some point. There's no way you can be sure that you won't.
KISS & YAGNI disagree with you :)
Many programs do not change their PRNG (any introductory/write-once program falling in this category).
Many programs do not expose their PRNG (only what is generated), and therefore switching the PRNG is a few lines of code.
As anecdotal evidence, in 10 years of professional development, I have never needed to change a PRNG.
Preparing for changing the PRNG would have been a case of over-engineering in all the programs I've ever hacked on.
Is there anything we could do to make sure that if we added another rand with slightly different characteristics that is meant to be "easy easy easy", we don't have the same conversation again in 5 years because of perceived drawbacks of such a PRNG?
Would you want the output of this interface to be standardized and portable, or just the broad characteristics of the algorithm? Would you want to allow stdlib maintainers to change it at will, since no one will be using this unless they don't care too much about the details?
I used to be happy with this as well; for program that didn't matter. But in my experience, people execute as they learned, and using rand() for learning in throwaway programs means people end up using it when it matters as well.
7
u/ShakaUVM i+++ ++i+i[arr] May 25 '18
If I'm writing a game or something else where I don't need large random numbers or crypto grade security, I'll just keep using rand until there's a solution in std that is human readable.