Lab 8 Comp 170-201 -- Dordal/Nabicht -- Wed, October 23, 2002 Final version due Fri Nov 1 In this lab you will analyze the "Birthday Problem": given a random selection of N people, what is the probability that two will have the same birthday? In this lab you will use arrays as a problem-solving tool, and also use appropriate functions to simplify the problem. (Before turning it in, be sure to note the two extra items at the end, after the ======.) To do this, we simulate the random sample of N people with an array of length N, filled with random numbers from g.nextInt(365), for a Random g. The numbers will all be in the range 0-364. Let's call the array bdays[]. First, fill bdays[] with random "birthdates". This represents *one* sample of N people; either there will be duplicate birthdays or not. As discussed below, we'll have to run this over and over. If N=50 and we run this 100 times and 37 times we get duplicate birthdays and 63 times we don't, then we'll say that, with a random sample of N=50 people, the probability that two people have the same birthday is about 37%. (Numerically this is way wrong, as will become clear when you look at your data.) After filling the array with random birthdates, *sort* the array. You may use L&L's Sorts class, if you wish. That's probably easiest: Sorts.selectionSort(bdays) The Sorts class is on my web page. Now, do the analysis. Figure out whether two people had the same birthday or not. This is true if there are two consecutive values in "bdays" with the same value. (They will be consecutive because you've sorted the array.) Here's a sample loop: boolean doubleflag = false; for (i=0; i