Class RandomUtil

java.lang.Object
net.guizhanss.guizhanlib.utils.RandomUtil

public final class RandomUtil extends Object
Utility methods about random numbers.
Author:
ybw0014
  • Constructor Details

    • RandomUtil

      public RandomUtil()
  • Method Details

    • randomInt

      public static int randomInt(int min, int max)
      Get a random Integer between min (inclusive) and max (inclusive).
      Parameters:
      min - The minimum range.
      max - The maximum range.
      Returns:
      The random Integer
    • randomDouble

      public static double randomDouble(double min, double max)
      Get a random Double between min (inclusive) and max (inclusive).
      Parameters:
      min - The minimum range.
      max - The maximum range.
      Returns:
      The random Double
    • testChance

      public static boolean testChance(int chance, int bound)
      Test chance of chance / bound.
      Parameters:
      chance - Numerator (must be greater than 0)
      bound - Denominator (must be greater than 0)
      Returns:
      If the roll succeed.