Package com.epicbot.api.shared.util
Class Random
- java.lang.Object
-
- com.epicbot.api.shared.util.Random
-
public class Random extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Random()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
nextBoolean()
static double
nextDouble()
Returns the next pseudorandom, uniformly distributeddouble
value between0.0
and1.0
.static double
nextDouble(double min, double max)
Generates a pseudo-random number between two given values.static boolean
nextGamble(int options)
Returns true with a chance of1 / options
.static double
nextGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributeddouble
value with mean0.0
and standard deviation1.0
.static double
nextGaussian(double min, double max, double sd)
Generates a pseudo-random number between the two given values with standard deviation.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.static int
nextGaussian(int min, int max, int sd)
Generates a pseudo-random number between the two given values with standard deviation.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.static int
nextInt(int min, int max)
Returns a pseudorandom, uniformly distributedint
value between min (inclusive) and max (exclusive), drawn from this random number generator's sequence.static java.awt.Point
nextPoint(java.awt.Shape area)
Generates a pseudo-random point within the given shape.
-
-
-
Method Detail
-
nextBoolean
public static boolean nextBoolean()
- Returns:
- the next random boolean value.
-
nextInt
public static int nextInt(int min, int max)
Returns a pseudorandom, uniformly distributedint
value 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
int
value 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 distributeddouble
value between0.0
and1.0
.- Returns:
- The generated pseudo-random double.
- See Also:
Random.nextDouble()
-
nextGaussian
public static double nextGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributeddouble
value with mean0.0
and standard deviation1.0
.- Returns:
- The generated pseudo-random double.
- See Also:
Random.nextGaussian()
-
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
public static java.awt.Point nextPoint(java.awt.Shape area)
Generates a pseudo-random point within the given shape.- Parameters:
area
- the shape- Returns:
- the point
-
-