I have written this piece of code which is supposed to simulate throwing dice many many times and counting that how many times each face is up. I have attached the output down there and as you can see it looks kind of strange. For example face 5 comes up exactly 10 times, faces 2, 3, 4 are about the same and face 6 comes zero in two rounds. The only face which acts about normal is 1. Can anyone explain this to me? Is this normal? Am I doing something wrong or is it something related to my system?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
unsigned long int freq1, freq2, freq3, freq4, freq5, freq6;
unsigned long int L00p = 1;
unsigned short int DF;
while (L00p <= 6e7){
srand (time(NULL));
DF = 1 + (rand ()%6);
switch (DF)
{
case 1:
++freq1;
break;
case 2:
++freq2;
break;
case 3:
++freq3;
break;
case 4:
++freq4;
break;
case 5:
++freq5;
break;
case 6:
++freq6;
break;
default:
break;}
++L00p;
}
printf ("%s%25s\n", "Dice's Face", "Face Frequency");
printf ("1%25lu\n", freq1);
printf ("2%25lu\n", freq2);
printf ("3%25lu\n", freq3);
printf ("4%25lu\n", freq4);
printf ("5%25lu\n", freq5);
printf ("6%25lu\n", freq6);
return 0;
}
and here is the program's output after four times running it: