Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSE2100 Birthday Paradox

Birthday Paradox

The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided n, the number of people in the room, is more than 23. This property is not really a paradox, but many people find it surprising. Design a Java program that can test this paradox by a series of experiments on randomly generated birthdays, which test this paradox for n = 5, 10, 15, 20, …, 100.

For each n, run this experiment at least 100,000 times and see how many experiments lead to the situation that at least two people have the same birthday. Calculate the proportion of these experiments and use it as an estimate of the probability.

For random number generator in Java. Check

http://stackoverflow.com/questions/5887709/gettingrandomnumbersinjava

Note to save CPU time, you can exit an experiment once you already find two people have the same birthday. This is a chance to use “break” statement.

You need to submit both source code and a typed report of the output of your program. Note your report need to be a .pdf file.