0
When using srand(time(0)) function in C program with for loop to print random numbers, what will be seed each time loop runs?
2 Réponses
+ 9
If I'm not mistaken, the seed will be the current time since 1/1/1970 in seconds.
+ 5
time(0) gives the time in seconds since the date Hatsy stated
and that is also the reason you should use the srand function once and not in a loop.
repeating it means you resetting the seed which in turn, would cause generating the same number with the rand() function IF the srand was used with the same time