public class RandomChoice
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
RandomChoice(double[] theProbabilities)
Construct a list of probabilities.
|
| Modifier and Type | Method and Description |
|---|---|
int |
generate(java.util.Random theGenerator)
Generate a random choice, based on the probabilities provided to the constructor.
|
int |
generate(java.util.Random theGenerator,
int skip)
Generate a random choice, but skip one of the choices.
|
public RandomChoice(double[] theProbabilities)
theProbabilities - The probability of each item in the list.public int generate(java.util.Random theGenerator)
theGenerator - The random number generator.public int generate(java.util.Random theGenerator,
int skip)
theGenerator - The random number generator.skip - The choice to skip.