public final class WeightedRandom extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
WeightedRandom.Choice |
| Constructor and Description |
|---|
WeightedRandom() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends WeightedRandom.Choice> |
getRandom(Random random,
Iterable<T> possibilities)
Selects a random item from a weighted distribution.
|
public static <T extends WeightedRandom.Choice> T getRandom(Random random, Iterable<T> possibilities)
T - the type of each of the possibilitiesrandom - the PRNG to usepossibilities - the distribution to sample fromCopyright © 2021. All rights reserved.