Hi all, I have a simulation problem.
A phone line connecting 2 cities only operates from 8AM to 12AM (16 hours) everyday. Customers in these 2 cities randomly make phone calls through it. The distribution for the time interval between 2 calls is approximately an exponential function with lamda = 1/6 minutes^(-1). The distribution for the time each phone call lasts is approximately N(6,4) in minutes. When the line is busy, the next customer just gives up making his/her phone call. Write a program to simulate the phone line problem when there are n phone lines. (n is an arbitrary integer).
I know the algorithm to simulate 1 phone line, but am lost when it comes to a variable number of phone lines. All I can think of is to keep track of the time when a call ends that is the earliest of all the phone lines, and the next call is made to that phone line.
However, after updating that line, if another call comes in, I won't
be able to find the phone line for that call to connect to without
going through all the phone lines and comparing the times. This is
going to be a big problem is there are thousands of phone lines.
Can someone please help me?
A small question -
When creating a random variate for a normal distribution, you get 2 normally distributed random variates from 2 random numbers, i.e. z1 = sqrt(-2ln(R_1))cos(2piR_2) and z2 = sqrt(-2ln(R_1))sin(2piR_2). To obtain normal variates X_i with means 6 and variance 4, we take X_i = 6 + 2*z_i. Since there are 2 z_i values, how do I know which value to take, if I need, say, 10 normal variates X_i?