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...Code:#include <stdio.h> #include <stdlib.h> #include <time.h> int rand_int(int,int); int a=1, b=6; main() { int die[100], n=0, i, dietot=0, l; double prob; for(i=0;i<100;i++) { die[i]=rand_int(1,6); printf("\nDie %d = %d",i+1,die[i]); dietot=dietot+die[i]; if(dietot==13)n++; l=i%3; if(l==0)dietot=0; } prob=n/100; 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!