mardi 6 novembre 2018

Why do I get the same result for 2 different rand values? (C Programming)

I want to simulate my 2 independent football matches but I always get the same result for two different matches. How do I fix that?

a is the result of the first match, b is the result of the second match. I entered srand(time(NULL)); but a and b gets the same result for two different matches. I want a and b to be completely different. What is the solution?

a=score[rand()%100];
b=score[rand()%100];




Aucun commentaire:

Enregistrer un commentaire