Question
JAVA language The Birthday Problem investigates the minimum number of people needed to have better than a 50% chance of at least two people have
JAVA language
The Birthday Problem investigates the minimum number of people needed to have better than a 50% chance of at least two people have the same birthday. When n = 23, a probability of approximately .506 is yielded. Use the probabilistic algorithm called the Monte Carlo algorithm and find the number of people in a room that yields an approximate probability greater than .75.
The following list may be helpful for completing the challenge.
Adopt the representation for a date as an number from 0 (for January 1st) to 364 (for December 31st). (You can use an alternate representation if you wish)
Using a random number generator, create a birthday for everyone in the room and put these birthdays in a list.
Check the list for two or more birthdays having the same date.
Do this many times, say 1000 or 10000
The number of times there is a match divided by the total is an approximation of the probability.
As a check of your work, a room of 23 people with a 1000 trials should produce a probability of around .506. (give or take quite a bit). If the number of trials are increased to 10000, the probability settles down to .506 (with just a little give and take)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started