Package w.util.random
Class SimpleWeightedRandom<E,T>
java.lang.Object
w.util.random.SimpleWeightedRandom<E,T>
- All Implemented Interfaces:
WeightedRandom<T>
- Author:
- whilein
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E,T> @NotNull WeightedRandomBuilder<T> builder(@NotNull Collection<E> collection, @NotNull Function<E, T> objectFunction, @NotNull ToDoubleFunction<E> weightFunction) static <T> @NotNull WeightedRandomBuilder<T>builder(@NotNull Collection<T> collection, @NotNull ToDoubleFunction<T> weightFunction) static <T> @NotNull WeightedRandomBuilder<T>
-
Constructor Details
-
SimpleWeightedRandom
public SimpleWeightedRandom()
-
-
Method Details
-
builder
@NotNull public static <T> @NotNull WeightedRandomBuilder<T> builder(@NotNull @NotNull Map<T, Double> map) -
builder
@NotNull public static <T> @NotNull WeightedRandomBuilder<T> builder(@NotNull @NotNull Collection<T> collection, @NotNull @NotNull ToDoubleFunction<T> weightFunction) -
builder
@NotNull public static <E,T> @NotNull WeightedRandomBuilder<T> builder(@NotNull @NotNull Collection<E> collection, @NotNull @NotNull Function<E, T> objectFunction, @NotNull @NotNull ToDoubleFunction<E> weightFunction) -
nextObject
- Specified by:
nextObjectin interfaceWeightedRandom<E>
-