Question
Assume you have three fair dices. Each dice has six surfaces labeled 1 through 6. Calculate the probability that the sum of three dices is
Assume you have three fair dices. Each dice has six surfaces labeled 1 through 6. Calculate the probability that the sum of three dices is greater than or equal to 10 (the sum should be between 3 and 18) when you throw these three dices. Writes a Java program to solve the above probability problem with Monte Carlo method (I do not need the mathematical solution. I just need the experimental solution). The program should have 10 producers and 1 consumers. They share a bounded buffer that can store 5 integers. Each producer will do 1,000,000 experiments. In each experiment, the producer generates 3 random numbers between 1 and 6 and check if the sum is greater than or equal to 10. Each producer needs to send the count (how many times the sum is greater than or equal to 10) to the consumer through the bounded buffer. Each of producers needs to send the count after 10,000 experiments (since each of them will do 1,000,000 experiments, each needs to send counts 100 times). The consumers will keep fetching the counts from the buffer and calculate the probability and prints the result after receives 100 counts. The program needs to synchronize the consumers and producers properly.
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