I want to make a simulation for a queueing model.So when my random number is <=from a threshold i suppose i have an arrival,or if it is > i suppose i have a departure.The problem is that when i use:
srand((unsigned)time(NULL));
random_num= ((double) rand() / (RAND_MAX));
printf("Random number is :%lf\n",random_num);
I see that it prints the same number a lot of times and then it changes it.Logicaly the problem is about the seed,what i can do to solve this problem?I want a lot of Uniform Random Numbers between 0 To 1,about 150000 random numbers. Thanks in advace Edit:here is my code
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
{
        int count=0,state=0,MAXIMUM=200000,i=0,k,f=0;   /* initialize values*/
        double p[10]={0},random_num,threshold,arrivals=0.0,arrivals_ar[10]={0.0},average,average_prev=0,diff,m_a=2.0,m_b=2.0,l;/* initialize*/
        printf("Give the value of lamda,choose between {1,2,3}\n");
        scanf("%lf",&l);                    /* as for lamda value*/
        if((l==1.0) || (l==2.0) || (l==3.0))
                        f=1;
        while(f==0){                    /* If value is wrong,ask again*/
            printf("You gave wrong value.Try again a number between {1,2,3}\n");
            scanf("%lf",&l);
            if((l==1.0) || (l==2.0) || (l==3.0))
                f=1;
         }
        threshold=l/(l+m_a);
        printf("Give the value of k,choose between {1,2,3,4,5,6,7,8,9}\n");
        f=0;
        scanf("%d",&k);
        if((k>=1) && (k<=9))
            f=1;
        while(f==0){
            printf("You gave wrong value,try again.Choose a number between {1,2,3,4,5,6,7,8,9}\n");
            scanf("%d",&k);
                if((k>=1) && (k<=9))
                        f=1;}
        printf("you gave lamda= %lf \n",l);
            printf("You gave kapa=%d\n",k);
ARRIVAL:    arrivals=arrivals+1;
        arrivals_ar[state]=arrivals_ar[state]+1;
        count=count+1;
        if (state==10){
            goto LOOP;}
        else{
            state=state+1;}
        if(state>k){
            printf("Now i use both servers\n");
                        threshold=l/(l+m_a+m_b);}
LOOP:       if (state==0){
            goto ARRIVAL;}
        else{
            srand((unsigned)time(NULL));
            random_num= ((double) rand() / (RAND_MAX));
            printf("Random number is :%e\n",random_num);
            if(random_num<threshold){
                goto ARRIVAL;}
            else{
                goto DEPARTURE;}}   
DEPARTURE:  count=count+1;
        state=state-1;
        if(state<=k){
            printf("Now i use only one server\n");
                        threshold=l/(l+m_a);}
        if(count<MAXIMUM){
            goto LOOP;}
        else{
            printf("Count has gone to maximum\n");
            while(i<=10){
                p[i]=arrivals_ar[i]/arrivals;
                average=average+p[i]*i;
                i=i+1;              }}
        printf("Average is %lf\n",average);
}
 
    