Class Rnd

java.lang.Object
host.anzo.commons.utils.Rnd

public class Rnd extends Object
  • Constructor Details

    • Rnd

      public Rnd()
  • Method Details

    • get

      public static double get()
    • get

      public static int get(int n)
      Gets a random number between 0(inclusive) and n(exclusive)
      Parameters:
      n - The superior limit (exclusive)
      Returns:
      if positive: A number from 0 to n-1, if negative A number from n-1 to 0
    • get

      public static long get(long n)
    • get

      public static double get(double n)
    • get

      public static float get(float n)
    • get

      public static int get(int min, int max)
    • get

      public static long get(long min, long max)
    • get

      public static float get(float min, float max)
    • get

      public static double get(double min, double max)
    • nextInt

      public static int nextInt()
    • nextDouble

      public static double nextDouble()
    • nextGaussian

      public static double nextGaussian()
    • nextBoolean

      public static boolean nextBoolean()
    • nextBytes

      public static byte[] nextBytes(byte[] bytes)
    • getChance

      public static boolean getChance(int chance)
      Randomizer for chance calculation Recommending to use instead Rnd.get(n, n)
      Parameters:
      chance - in percent from 0 to 100
      Returns:
      true if success If chance <= 0, return false If chance >= 100, return true
    • getChance

      public static boolean getChance(double chance)
      Randomizer for chance calculation Recommending to use instead Rnd.get(n, n) if we need high precision values
      Parameters:
      chance - in percent from 0 to 100
      Returns:
      true if success If chance <= 0, return false If chance >= 100, return true
    • getChance

      public static boolean getChance(int chance, int divider)
    • get

      public static <E> E get(E @NotNull [] list)
    • get

      public static int get(int @NotNull [] list)
    • get

      @Nullable public static <E> E get(@NotNull @NotNull List<E> list)
    • get

      public static <E> E get(@NotNull @NotNull List<E> list, E defaultValue)
    • get

      @Nullable public static <E> E get(@NotNull @NotNull Collection<E> collection)
    • get

      public static <E extends Enum<E>> E get(@NotNull @NotNull Class<E> clazz)
    • getRouletteEntries

      @NotNull public static @NotNull List<RouletteRandomEntry> getRouletteEntries(List<RouletteRandomEntry> input, int count)
    • getRouletteEntry

      @Nullable public static @Nullable RouletteRandomEntry getRouletteEntry(List<RouletteRandomEntry> input)
    • getRandomWithTick

      public static double getRandomWithTick(double min, double max, long serverTick, long randomSeed)
    • getString

      @NotNull public static @NotNull String getString(int length)
    • getStringHex

      @NotNull public static @NotNull String getStringHex(int length)