java.lang.Object
technology.sola.engine.utils.SolaRandom
Wrapper around
Random
that exposes some additional convenience methods. This wrapper will ensure that random
number generation will work across different SolaPlatform
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static float
static float
nextFloat
(float min, float max) Returns a pseudorandom, uniformly distributed float value between min (inclusive) and max value (inclusive)static int
nextInt
(int bound) Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)static int
nextInt
(int min, int max) Returns a pseudorandom, uniformly distributed int value between min (inclusive) and max value (inclusive)static void
setSeed
(long seed) Sets the seed for random number generation.
-
Method Details
-
setSeed
public static void setSeed(long seed) Sets the seed for random number generation.- Parameters:
seed
- the seed
-
nextBoolean
public static boolean nextBoolean()- Returns:
- the next pseudorandom, uniformly distributed boolean value
-
nextInt
public static int nextInt(int bound) Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)- Parameters:
bound
- the exclusive boundary value- Returns:
- the random int value
-
nextInt
public static int nextInt(int min, int max) Returns a pseudorandom, uniformly distributed int value between min (inclusive) and max value (inclusive)- Parameters:
min
- the inclusive min valuemax
- the inclusive max value- Returns:
- the random int value
-
nextFloat
public static float nextFloat()- Returns:
- the next pseudorandom, uniformly distributed float value between 0.0 and 1.
-
nextFloat
public static float nextFloat(float min, float max) Returns a pseudorandom, uniformly distributed float value between min (inclusive) and max value (inclusive)- Parameters:
min
- the inclusive min valuemax
- the inclusive max value- Returns:
- the random float value
-