Interface RandomGenerator
public interface RandomGenerator
Random number generator
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns a random double between 0.0 (inclusive) and 1.0 (exclusive).doublenextDouble(double bound) Returns a random double between 0.0 (inclusive) and the specified bound (exclusive).doublenextDouble(double start, double end) Returns a random double between the specified start (inclusive) and end (exclusive).intnextInt()Returns a random integer across the entire int range, including negative values.intnextInt(int bound) Returns a random integer between 0 (inclusive) and the specified bound (exclusive).intnextInt(int start, int end) Returns a random integer between the specified start (inclusive) and end (exclusive).
-
Method Details
-
nextInt
int nextInt(int start, int end) Returns a random integer between the specified start (inclusive) and end (exclusive).- Parameters:
start- the lower bound (inclusive)end- the upper bound (exclusive)- Returns:
- a random integer in range [start, end), or 0 if start > end
-
nextInt
int nextInt(int bound) Returns a random integer between 0 (inclusive) and the specified bound (exclusive).- Parameters:
bound- the upper bound (exclusive)- Returns:
- a random integer in range [0, bound)
-
nextInt
int nextInt()Returns a random integer across the entire int range, including negative values.- Returns:
- a random integer
-
nextDouble
double nextDouble(double start, double end) Returns a random double between the specified start (inclusive) and end (exclusive).- Parameters:
start- the lower bound (inclusive)end- the upper bound (exclusive)- Returns:
- a random double in range [start, end), or 0 if start > end
-
nextDouble
double nextDouble(double bound) Returns a random double between 0.0 (inclusive) and the specified bound (exclusive).- Parameters:
bound- the upper bound (exclusive)- Returns:
- a random double in range [0, bound)
-
nextDouble
double nextDouble()Returns a random double between 0.0 (inclusive) and 1.0 (exclusive).- Returns:
- a random double in range [0, 1)
-