Package com.epicbot.api.shared.util
Class Random
java.lang.Object
com.epicbot.api.shared.util.Random
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic doubleReturns the next pseudorandom, uniformly distributeddoublevalue between0.0and1.0.static doublenextDouble(double min, double max) Generates a pseudo-random number between two given values.static booleannextGamble(int options) Returns true with a chance of1 / options.static doubleReturns the next pseudorandom, Gaussian ("normally") distributeddoublevalue with mean0.0and standard deviation1.0.static doublenextGaussian(double min, double max, double sd) Generates a pseudo-random number between the two given values with standard deviation.static doublenextGaussian(double min, double max, double mean, double sd) Generates a pseudo-random number between the two given values with standard deviation about a provided mean.static intnextGaussian(int min, int max, int sd) Generates a pseudo-random number between the two given values with standard deviation.static intnextGaussian(int min, int max, int mean, int sd) Generates a pseudo-random number between the two given values with standard deviation about a provided mean.static intnextInt(int min, int max) Returns a pseudorandom, uniformly distributedintvalue between min (inclusive) and max (exclusive), drawn from this random number generator's sequence.static PointGenerates a pseudo-random point within the given shape.
-
Constructor Details
-
Random
public Random()
-
-
Method Details
-
nextBoolean
public static boolean nextBoolean()- Returns:
- the next random boolean value.
-
nextInt
public static int nextInt(int min, int max) Returns a pseudorandom, uniformly distributedintvalue between min (inclusive) and max (exclusive), drawn from this random number generator's sequence.- Parameters:
min- lower bound (inclusive)max- upper bound (exclusive)- Returns:
- the next pseudorandom, uniformly distributed
intvalue between min (inclusive) and max (exclusive) from this random number generator's sequence
-
nextGamble
public static boolean nextGamble(int options) Returns true with a chance of1 / options.- Parameters:
options- Amount of options to gamble with.- Returns:
- true if
nextInt(0, options)equals 0
-
nextDouble
public static double nextDouble(double min, double max) Generates a pseudo-random number between two given values.- Parameters:
min- The minimum value (inclusive).max- The maximum value (exclusive).- Returns:
- The generated pseudo-random double.
-
nextDouble
public static double nextDouble()Returns the next pseudorandom, uniformly distributeddoublevalue between0.0and1.0.- Returns:
- The generated pseudo-random double.
- See Also:
-
nextGaussian
public static double nextGaussian()Returns the next pseudorandom, Gaussian ("normally") distributeddoublevalue with mean0.0and standard deviation1.0.- Returns:
- The generated pseudo-random double.
- See Also:
-
nextGaussian
public static int nextGaussian(int min, int max, int sd) Generates a pseudo-random number between the two given values with standard deviation.- Parameters:
min- The minimum value (inclusive).max- The maximum value (exclusive).sd- Standard deviation.- Returns:
- The generated pseudo-random integer.
-
nextGaussian
public static double nextGaussian(double min, double max, double sd) Generates a pseudo-random number between the two given values with standard deviation.- Parameters:
min- The minimum value (inclusive).max- The maximum value (exclusive).sd- Standard deviation.- Returns:
- The generated pseudo-random double.
-
nextGaussian
public static int nextGaussian(int min, int max, int mean, int sd) Generates a pseudo-random number between the two given values with standard deviation about a provided mean.- Parameters:
min- The minimum value (inclusive).max- The maximum value (exclusive).mean- The mean (>= min and < max).sd- Standard deviation.- Returns:
- The generated pseudo-random double.
-
nextGaussian
public static double nextGaussian(double min, double max, double mean, double sd) Generates a pseudo-random number between the two given values with standard deviation about a provided mean.- Parameters:
min- The minimum value (inclusive).max- The maximum value (exclusive).mean- The mean (>= min and < max).sd- Standard deviation.- Returns:
- The generated pseudo-random double.
-
nextPoint
Generates a pseudo-random point within the given shape.- Parameters:
area- the shape- Returns:
- the point
-