Today in interview they asked me this question? How to generate a discrete random variable in Java? I couldn't do it but I wonder the solution. They gave me an array:
double[] probabilities={.2,.1,.3,.4};
double[] outcomes ={4,5,8,11.5};
And this should give the answer:
double discreteRV = problem.randPMF(probabilities,outcomes);
I couldn't understand how to solve this question.
Aucun commentaire:
Enregistrer un commentaire