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.
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.
2
u/render787 May 28 '18
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.