Hello everyone. I'm having a bit of a problem getting my probability program to work. It's supposed to determine the probability that 13 will be achieved with 3 dice rolls but every die gets the same value.
Here is the code:
I'm really at a loss as to why this code won't work. My seed should give a different random number each time the loop calls rand_int but I just get 100 identical dice...
int a=1, b=6;
int die, n=0, i, dietot=0, l;
printf("\nDie %d = %d",i+1,die[i]);
printf("\nThe probability of throwing 3 dice and getting 13 is %lf out of 100",prob);
int rand_int(int a, int b)
srand(time(0)); //takes the current system time as a seed number
return (a + rand()%(b-a+1));
Any help would be greatly appreciated!