Package com.bayesserver
Class RandomDefault
- java.lang.Object
-
- com.bayesserver.RandomDefault
-
- All Implemented Interfaces:
RandomNumberGenerator
public final class RandomDefault extends Object implements RandomNumberGenerator
Default random number generator, that is consistent across the different APIs.
-
-
Constructor Summary
Constructors Constructor Description RandomDefault()
Initializes a new instance of theRandomDefault
class, using a seed generated from the system clock.RandomDefault(int seed)
Initializes a new instance of theRandomDefault
class, with a specified seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
nextDouble()
Generates a random floating-point number that is greater than or equal to 0.0, and less than 1.0.int
nextInt(int minValue, int maxValue)
Generates a random integer between [minValue..maxValue).
-
-
-
Constructor Detail
-
RandomDefault
public RandomDefault()
Initializes a new instance of theRandomDefault
class, using a seed generated from the system clock.
-
RandomDefault
public RandomDefault(int seed)
Initializes a new instance of theRandomDefault
class, with a specified seed.
-
-
Method Detail
-
nextDouble
public double nextDouble()
Generates a random floating-point number that is greater than or equal to 0.0, and less than 1.0.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
-
nextInt
public int nextInt(int minValue, int maxValue)
Generates a random integer between [minValue..maxValue).- Specified by:
nextInt
in interfaceRandomNumberGenerator
- Parameters:
minValue
- the least legal value for the Random number.maxValue
- One greater than the greatest legal return value.- Returns:
- Random int between [minValue..maxValue).
-
-