This question already has an answer here:
- srand() — why call it only once? 7 answers
so I am trying to fill an array with random integers.
for (int i = 0; i < 2; i++){
srand(time(NULL));
array[i]=rand()%30; }`
Here is my code so far. I am currently getting the same random number twice. Would like to know if there is a way around this?
Aucun commentaire:
Enregistrer un commentaire