Class Random


  • public class Random
    extends java.lang.Object
    The Random class provides methods for generating random numbers and introduces fatigue-based randomness for script execution.
    • Constructor Summary

      Constructors 
      Constructor Description
      Random()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double doubles​(double max)
      Generates a random double within the specified range [0, max).
      static double doubles​(double min, double max)
      Generates a random double within the specified range [min, max).
      static int ints​(double min, int max)
      Generates a random integer within the specified range [min, max).
      static int ints​(int max)
      Generates a random integer within the specified range [0, max).
      static boolean nextBoolean()
      Generates a random boolean using heuristics.
      static double nextDouble​(double max)
      Generates a random double around the specified range [0, max).
      static double nextDouble​(double min, double max)
      Generates a random double around the specified range [min, max).
      static int nextInt​(int max)
      Generates a random integer around the specified range [0, max).
      static int nextInt​(int min, int max)
      Generates a random integer around the specified range [min, max).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Random

        public Random()
    • Method Detail

      • nextBoolean

        public static boolean nextBoolean()
        Generates a random boolean using heuristics.
        Returns:
        A random boolean value.
      • nextInt

        public static int nextInt​(int max)
        Generates a random integer around the specified range [0, max).

        Note: When fatigue is enabled, the returned value may fall below the specified minimum or exceed the maximum range.

        Parameters:
        max - The exclusive upper bound of the random integer.
        Returns:
        A random integer.
      • nextInt

        public static int nextInt​(int min,
                                  int max)
        Generates a random integer around the specified range [min, max).

        Note: When fatigue is enabled, the returned value may fall below the specified minimum or exceed the maximum range.

        Parameters:
        min - The inclusive lower bound of the random integer.
        max - The exclusive upper bound of the random integer.
        Returns:
        A random integer.
      • nextDouble

        public static double nextDouble​(double max)
        Generates a random double around the specified range [0, max).

        Note: When fatigue is enabled, the returned value may fall below the specified minimum or exceed the maximum range.

        Parameters:
        max - The exclusive upper bound of the random double.
        Returns:
        A random double.
      • nextDouble

        public static double nextDouble​(double min,
                                        double max)
        Generates a random double around the specified range [min, max).

        Note: When fatigue is enabled, the returned value may fall below the specified minimum or exceed the maximum range.

        Parameters:
        min - The inclusive lower bound of the random double.
        max - The exclusive upper bound of the random double.
        Returns:
        A random double.
      • doubles

        public static double doubles​(double max)
        Generates a random double within the specified range [0, max).
        Parameters:
        max - The exclusive upper bound of the random double.
        Returns:
        A random double.
      • doubles

        public static double doubles​(double min,
                                     double max)
        Generates a random double within the specified range [min, max).
        Parameters:
        min - The inclusive lower bound of the random double.
        max - The exclusive upper bound of the random double.
        Returns:
        A random double.
      • ints

        public static int ints​(int max)
        Generates a random integer within the specified range [0, max).
        Parameters:
        max - The exclusive upper bound of the random integer.
        Returns:
        A random integer.
      • ints

        public static int ints​(double min,
                               int max)
        Generates a random integer within the specified range [min, max).
        Parameters:
        min - The inclusive lower bound of the random integer.
        max - The exclusive upper bound of the random integer.
        Returns:
        A random integer.