Monday, April 30, 2012

Java: How do I simulate probability?

I have a set of over 100 different probabilities ranging from 0.007379 all the way to 0.913855 (These probabilities were collected from an actuary table http://www.ssa.gov/oact/STATS/table4c6.html). In Java, how can I use these probabilities to determine whether something will happen or not? Something along these lines...



public boolean prob(double probability){
if (you get lucky)
return true;
return false;
}




No comments:

Post a Comment