public class WeightedRandom
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
WeightedRandom.Item |
Constructor and Description |
---|
WeightedRandom() |
Modifier and Type | Method and Description |
---|---|
static <T extends WeightedRandom.Item> |
getRandomItem(java.util.List<T> collection,
int weight) |
static <T extends WeightedRandom.Item> |
getRandomItem(java.util.Random random,
java.util.List<T> collection) |
static <T extends WeightedRandom.Item> |
getRandomItem(java.util.Random random,
java.util.List<T> collection,
int totalWeight) |
static int |
getTotalWeight(java.util.List<? extends WeightedRandom.Item> collection) |
public static int getTotalWeight(java.util.List<? extends WeightedRandom.Item> collection)
public static <T extends WeightedRandom.Item> T getRandomItem(java.util.Random random, java.util.List<T> collection, int totalWeight)
public static <T extends WeightedRandom.Item> T getRandomItem(java.util.List<T> collection, int weight)
public static <T extends WeightedRandom.Item> T getRandomItem(java.util.Random random, java.util.List<T> collection)