Package com.osrsbots.orb.api.util
Class Random
- java.lang.Object
-
- com.osrsbots.orb.api.util.Random
-
public class Random extends java.lang.ObjectThe 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 doubledoubles(double max)Generates a random double within the specified range [0, max).static doubledoubles(double min, double max)Generates a random double within the specified range [min, max).static intints(double min, int max)Generates a random integer within the specified range [min, max).static intints(int max)Generates a random integer within the specified range [0, max).static booleannextBoolean()Generates a random boolean using heuristics.static doublenextDouble(double max)Generates a random double around the specified range [0, max).static doublenextDouble(double min, double max)Generates a random double around the specified range [min, max).static intnextInt(int max)Generates a random integer around the specified range [0, max).static intnextInt(int min, int max)Generates a random integer around the specified range [min, max).
-
-
-
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.
-
-