Hi everybody
I have assignment performing the simulation of birthday problem that is:
what is the probability that in a class of 23 children, two or more children have the same birthday?
the task is I have to perform some steps using any kind of software. In this case, I decide to use ms. excel, but I have no idea of some of the steps that had been given to me as instruction from my lecturer.
step 1: initialize n = 100.000 (number of runs)
teller = 0; r = 1
step 2
for i = 1, ... , 23 use RAND to generate a random number Ui and compute the birthday
ki = 1 + rounddown (365 * Ui)
step 3
Test whether Ki - Kj = 0, for some i is not equal to j
if so,
teller = teller + 1
r = r + 1. If r < n, repeat steps 2
Step 4
the estimation of the desired probability = teller / n
my questions?
1. how to initialize n as many as 100.000?
2. what does teller = 0 and r = 1 mean? (I am not sure of whether the writing of teller is true since I just note my lecturer's writing in blackboard)
3. In step 3, what does teller = teller 1 mean, and why if r < n, I must repeat steps 2
thank you very much
Bookmarks