I have several threads which all run the same function. In each of these they generate a different random number several times. We tried to do this by putting srand(time(0))
at the start of the function, but it seems that they all get the same number.
Do we need to call srand(time(0))
only once per program, i.e at the start of main
(for example), at the start of each function that is called several times, or something else?