If I put i < 100
or i < 1000
in the for loop, it will generate 100/1000 numbers, respectively. However, when I put 10000, nothing appears when I run it, why is this?
int i;
int random_number;
srand((unsigned)time(NULL));
for (i = 0; i < 10000; i++) {
random_number = (int) (10.0 * rand() / (RAND_MAX + 1.0));
printf("%d", random_number);
}
I have been tasked to tabulate the percentage of 10,000 (0-9) random numbers. So any help at all with further code for this would also be greatly appreciated.
(I am new to C and StackOverflow so I am still learning how to use both - so I apologise in advance if I have used either of them wrong!)
Thank you!
Aucun commentaire:
Enregistrer un commentaire