public interface PseudoRandomGenerator
A pseudo-random generator.
-
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns a random uniformly distributeddoublevalue in the range [0, 1).doubleReturns an exponentially distributeddoublevalue with mean 1.intnextInt()Returns a random uniformly distributed 32-bitintvalue.longnextLong()Returns a random uniformly distributed 64-bitlongvalue.reset(long seed) Resets the pseudo-random generator using the given 64-bit seed value.intuniformInt(int exclusiveBound) Returns a random uniformly distributed 32-bit {code int} value greater than or equal to 0 and less than the given upper bound.
-
Method Details
-
nextLong
long nextLong()Returns a random uniformly distributed 64-bitlongvalue.- Returns:
- a random value
-
nextInt
int nextInt()Returns a random uniformly distributed 32-bitintvalue.- Returns:
- a random value
-
uniformInt
int uniformInt(int exclusiveBound) Returns a random uniformly distributed 32-bit {code int} value greater than or equal to 0 and less than the given upper bound.The behavior is undefined, if the given upper bound is non-positive.
- Parameters:
exclusiveBound- the (exclusive) upper bound (must be positve)- Returns:
- a random value
-
reset
Resets the pseudo-random generator using the given 64-bit seed value.- Parameters:
seed- the seed value- Returns:
- this
-
nextDouble
double nextDouble()Returns a random uniformly distributeddoublevalue in the range [0, 1).- Returns:
- a random value
-
nextExponential
double nextExponential()Returns an exponentially distributeddoublevalue with mean 1.- Returns:
- a random value
-