Menu

(Solved) : 10 Create Method Public Static Int Birthdaysampler Int Numpeople Creates Random Sample Siz Q26621071 . . .

In Java program this method

(10) Create a method public static int birthdaySampler(int numPeople) which creates a random sample of size numPeople from the range of integers 0 to 364 inclusive and returns a 1 if there are two integers in the sample that are the same and 0 if all of the integers are distinct. (10) Create a method public static estimateProbability(int numPeople, int num- Trials) which iterates over numTrials samples of size numPeople and returns the ratio of the number of times at least two of the integers in the sample were the same to the number of trials. (5) Read the entry on the birthday paradox at wikipedia and compare your estimates with the actual values given there for various values of numPeople. Comment on your results. Include these comments below your function definition. You should use about 100000 trials when testing.

(10) Create a method public static int birthdaySampler(int numPeople) which creates a random sample of size numPeople from the range of integers 0 to 364 inclusive and returns a 1 if there are two integers in the sample that are the same and 0 if all of the integers are distinct. (10) Create a method public static estimateProbability(int numPeople, int num- Trials) which iterates over numTrials samples of size numPeople and returns the ratio of the number of times at least two of the integers in the sample were the same to the number of trials. (5) Read the entry on the birthday paradox at wikipedia and compare your estimates with the actual values given there for various values of numPeople. Comment on your results. Include these comments below your function definition. You should use about 100000 trials when testing. Show transcribed image text

Expert Answer


Answer to 10 Create Method Public Static Int Birthdaysampler Int Numpeople Creates Random Sample Siz Q26621071 . . .

OR