lundi 27 août 2018

Generating array with random integers C [duplicate]

This question already has an answer here:

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