There is a wide use of srand()/rand()
calls in 3rd party libraries, with predefined seeds. The problem arises when combining different libraries in the same process. Sometimes it's hard to ensure the right sequence of calls, a mix of srand()
and rand()
calls is possible. Another problem is inability to choose seeding value on application level. As a general rule, should we avoid using srand()
in libraries (including Open Source), leaving the task of seeding to applications?
For the reasons you mentioned, among others, it's better practice in real life applications to use boost::random
or C++11 random
library
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With