The caption pretty much says it.
PS. This is for C++ Windows program.
No, as per the Standard, because once you call srand()
it affects rand()
calls from all threads.
C library function srand()
is single-threaded just like all other functions are, which means if you call srand()
from one thread, it affects the number-seqeunce generated from rand()
in other threads as well.
But Microsoft provides non-standard srand()
which does require you to call it from all threads.