Question
Write a Java function with prototype: double custom(double [] outcomes, double [] probabilities), that returns a random value that is distributed according to an arbitrary
Write a Java function with prototype: double custom(double [] outcomes, double [] probabilities), that returns a random value that is distributed according to an arbitrary distribution described in a table of discrete values/outcomes (for the random variable) and the probability of those values.
The main(...) function should accept 10 parameters from the calling environment. These 10 parameters represent 5 pairs of outcome values and associated probabilities. For instance, the custom distribution given in Table 1 is given in input in the following way:
Outcome Probability 10 20 40 70 0.16 0.13 0.22 0.20 0.29 ble 1: A custom probability distributionStep 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