Class RandomExtra

java.lang.Object
com.hypixel.hytale.math.random.RandomExtra

public final class RandomExtra extends Object
  • 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

      public static Duration randomDuration(@Nonnull Duration from, @Nonnull Duration to)
    • randomBoolean

      public static boolean randomBoolean()
    • randomElement

      public static <T> T randomElement(@Nonnull List<T> collection)
    • jitter

      @Nonnull public static Vector3d jitter(@Nonnull Vector3d vec, double maxRange)
    • 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

      public static <T> void reservoirSample(@Nonnull List<T> input, @Nonnull Predicate<T> matcher, int count, @Nonnull List<T> picked)
    • reservoirSample

      public static <E, S extends List<E>, F, T extends List<F>, G, H> void reservoirSample(@Nonnull S input, @Nonnull TriFunction<E,G,H,F> filter, int count, @Nonnull T picked, G g, H h)
    • reservoirSample

      public static <E, T extends List<E>> void reservoirSample(E element, int count, @Nonnull T picked)
    • pickWeightedIndex

      public static int pickWeightedIndex(@Nonnull double[] weights)