2 ms·
I would argue the opposite - while there are many cases where you want values to be consistent across runs, I don't think they're the majority of the casual use
by int_19h 9y ago
I would argue the opposite - while there are many cases where you want values to be consistent across runs, I don't think they're the majority of the casual use of rand(). And especially for something that has "random" right there in the name, it is a very strange and counter-intuitive default.
Furthermore, even for those cases where you do want consistency, I doubt you'd want a hardcoded seed value. Most of such cases allow the seed to be parametrized between runs without recompiling (via command line arguments, configs etc), and so they'll still need to invoke srand to set the seed.
On the other hand, saying that without srand, the default is random, would actually allow modern implementations to e.g. initialize from /dev/random. Right now there's basically no cross-platform way to set a truly random seed in ISO C.