samedi 29 octobre 2016

generate random number between 10 to 1000000000 in C

I am using this code to create; but all the results are in range of 10-32.000.

can you tell me what I am doing wrong?

for(i=0;i<N;i++){                
    *(A+i)=rand() % (1000000000 - 10 + 1) + 10;
    printf("%lu\n",*(A+i));
}




Aucun commentaire:

Enregistrer un commentaire