Date (d) is added 1, but the second time the array of time, only to find that only one number is 12 (I lose n is 12, and n is a few, I input the number is a few), everything else is 0, determine the generated random number is no problem, why is this so?

CodePudding user response:
The srand (time (NULL)); In the second for loop try above, namely do not initialize the random seeds in the loopCodePudding user response: