c++ - Problems of using srand() in libraries -
there wide utilize of srand()/rand()
calls in 3rd party libraries, predefined seeds. problem arises when combining different libraries in same process. it's hard ensure right sequence of calls, mix of srand()
, rand()
calls possible. problem inability take seeding value on application level. general rule, should avoid using srand()
in libraries (including open source), leaving task of seeding applications?
for reasons mentioned, among others, it's improve practice in real life applications utilize boost::random
or c++11 random
library
c++ c random software-design
No comments:
Post a Comment