Home > Back-end >  C a random number, array
C a random number, array

Time:10-14

Iterate through group for the first time, have determined is 0, examine variables,
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 loop

CodePudding user response:

reference 1st floor qybao response:
the srand (time (NULL)); In the second for loop try above, namely not in a loop to initialize the random seed

Really, thank you