mardi 21 septembre 2021

Filling multiple arrays with random numbers in C [duplicate]

Basically what my program needs to do is generate 100 random arrays ranging from size 2-100. My only problem is when attempting to use srand() inside a loop I can increment it giving me a new value for next incrementation but then each array has the same numbers except for the very last one. For example:

1,5
1,5,8
1,5,8,4
1,5,8,4,7

So my question is what is a tactic that would give srand() a different value every time so that it is re-seeding differently for each call.




Aucun commentaire:

Enregistrer un commentaire