Package com.hypixel.hytale.math.random
Class RandomExtra
java.lang.Object
com.hypixel.hytale.math.random.RandomExtra
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Vector3dstatic intpickWeightedIndex(double[] weights) static doublestatic booleanstatic DurationrandomDuration(Duration from, Duration to) static <T> TrandomElement(List<T> collection) static <T> TrandomIntWeightedElement(Collection<? extends T> elements, ToIntFunction<T> weight) static <T> TrandomIntWeightedElement(Collection<? extends T> elements, ToIntFunction<T> weight, int sumWeights) static doublerandomRange(double[] range) static doublerandomRange(double from, double to) static floatrandomRange(float[] range) static floatrandomRange(float from, float to) static intrandomRange(int bound) static intrandomRange(int[] range) static intrandomRange(int from, int to) static longrandomRange(long from, long to) static <T,U> T randomWeightedElement(Collection<? extends T> elements, BiPredicate<T, U> filter, ToDoubleBiFunction<T, U> weight, double sumWeights, U meta) static <T> TrandomWeightedElement(Collection<? extends T> elements, Predicate<T> filter, ToDoubleFunction<T> weight) static <T> TrandomWeightedElement(Collection<? extends T> elements, Predicate<T> filter, ToDoubleFunction<T> weight, double sumWeights) static <T> TrandomWeightedElement(Collection<? extends T> elements, ToDoubleFunction<T> weight) static <T> TrandomWeightedElement(Collection<? extends T> elements, ToDoubleFunction<T> weight, double sumWeights) static <T> TrandomWeightedElementFiltered(Collection<? extends T> elements, Predicate<T> filter, ToIntFunction<T> weight) static <T> TrandomWeightedElementFiltered(Collection<? extends T> elements, Predicate<T> filter, ToIntFunction<T> weight, int sumWeights) static <E,T extends List<E>>
voidreservoirSample(E element, int count, T picked) static <T> voidreservoirSample(List<T> input, Predicate<T> matcher, int count, List<T> picked) reservoirSample(S input, TriFunction<E, G, H, F> filter, int count, T picked, G g, H h)
-
Constructor Details
-
RandomExtra
private RandomExtra()
-
-
Method Details
-
randomBinomial
public static double randomBinomial() -
randomRange
public static double randomRange(@Nonnull double[] range) -
randomRange
public static double randomRange(double from, double to) -
randomRange
public static float randomRange(@Nonnull float[] range) -
randomRange
public static float randomRange(float from, float to) -
randomRange
public static int randomRange(int bound) -
randomRange
public static int randomRange(@Nonnull int[] range) -
randomRange
public static int randomRange(int from, int to) -
randomRange
public static long randomRange(long from, long to) -
randomDuration
-
randomBoolean
public static boolean randomBoolean() -
randomElement
-
jitter
-
randomWeightedElement
@Nullable public static <T> T randomWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull ToDoubleFunction<T> weight) -
randomWeightedElement
@Nullable public static <T> T randomWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull ToDoubleFunction<T> weight, double sumWeights) -
randomIntWeightedElement
@Nullable public static <T> T randomIntWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull ToIntFunction<T> weight) -
randomIntWeightedElement
@Nullable public static <T> T randomIntWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull ToIntFunction<T> weight, int sumWeights) -
randomWeightedElementFiltered
@Nullable public static <T> T randomWeightedElementFiltered(@Nonnull Collection<? extends T> elements, @Nonnull Predicate<T> filter, @Nonnull ToIntFunction<T> weight) -
randomWeightedElementFiltered
@Nullable public static <T> T randomWeightedElementFiltered(@Nonnull Collection<? extends T> elements, @Nonnull Predicate<T> filter, @Nonnull ToIntFunction<T> weight, int sumWeights) -
randomWeightedElement
@Nullable public static <T> T randomWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull Predicate<T> filter, @Nonnull ToDoubleFunction<T> weight) -
randomWeightedElement
@Nullable public static <T> T randomWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull Predicate<T> filter, @Nonnull ToDoubleFunction<T> weight, double sumWeights) -
randomWeightedElement
@Nullable public static <T,U> T randomWeightedElement(@Nonnull Collection<? extends T> elements, @Nonnull BiPredicate<T, U> filter, @Nonnull ToDoubleBiFunction<T, U> weight, double sumWeights, U meta) -
reservoirSample
-
reservoirSample
public static <E,S extends List<E>, void reservoirSampleF, T extends List<F>, G, H> (@Nonnull S input, @Nonnull TriFunction<E, G, H, F> filter, int count, @Nonnull T picked, G g, H h) -
reservoirSample
-
pickWeightedIndex
public static int pickWeightedIndex(@Nonnull double[] weights)
-