public final class DefaultRandomService extends Object implements RandomService
| Constructor and Description |
|---|
DefaultRandomService() |
DefaultRandomService(Long seed) |
| Modifier and Type | Method and Description |
|---|---|
long |
getSeed()
Returns the seed
|
boolean |
nextBoolean()
Generates a random boolean
|
double |
nextDouble()
Generates a random positive double
|
double |
nextDouble(double upperBound)
Generates a random double between 0 (inclusive) and
upperBound (exclusive) |
double |
nextDouble(double lowerBound,
double upperBound)
Generates a random double between
lowerBound (inclusive) and upperBound (exclusive) |
float |
nextFloat()
Generates a random positive float between 0 and 1 (inclusive)
|
float |
nextFloat(float upperBound)
Generates a random float between 0 (inclusive) and
upperBound (exclusive) |
float |
nextFloat(float lowerBound,
float upperBound)
Generates a random float between
lowerBound and upperBound (inclusive) |
int |
nextInt()
Generates a random positive int
|
int |
nextInt(int upperBound)
Generates a random int between 0 and
upperBound (inclusive). |
int |
nextInt(int lowerBound,
int upperBound)
Generates a random int between
lowerBound and upperBound (inclusive). |
long |
nextLong()
Generates a random positive long
|
long |
nextLong(long upperBound)
Generates a random long between 0 and
upperBound (inclusive). |
long |
nextLong(long lowerBound,
long upperBound)
Generates a random long between @{code lowerBound} and
upperBound (inclusive) |
public DefaultRandomService()
public DefaultRandomService(Long seed)
public long getSeed()
RandomServicegetSeed in interface RandomServicepublic long nextLong()
NumberServicenextLong in interface NumberServicepublic boolean nextBoolean()
RandomServicenextBoolean in interface RandomServicepublic int nextInt()
NumberServicenextInt in interface NumberServicepublic int nextInt(int upperBound)
NumberServiceupperBound (inclusive).
If upperBound equals Integer.MAX_VALUE generates a random int between 0 (inclusive)
and upperBound (exclusive).
nextInt in interface NumberServicepublic int nextInt(int lowerBound,
int upperBound)
NumberServicelowerBound and upperBound (inclusive).
If upperBound equals Integer.MAX_VALUE generates a random int between
lowerBound (inclusive) and upperBound (exclusive).
nextInt in interface NumberServicepublic long nextLong(long upperBound)
NumberServiceupperBound (inclusive).
If upperBound equals Long.MAX_VALUE generates a random long between 0 (inclusive)
and upperBound (exclusive).
nextLong in interface NumberServicepublic long nextLong(long lowerBound,
long upperBound)
NumberServiceupperBound (inclusive)
If upperBound equals Long.MAX_VALUE generates a random long between
lowerBound (inclusive) and upperBound (exclusive).
nextLong in interface NumberServicepublic double nextDouble()
NumberServicenextDouble in interface NumberServicepublic double nextDouble(double upperBound)
NumberServiceupperBound (exclusive)nextDouble in interface NumberServicepublic double nextDouble(double lowerBound,
double upperBound)
NumberServicelowerBound (inclusive) and upperBound (exclusive)nextDouble in interface NumberServicepublic float nextFloat()
NumberServicenextFloat in interface NumberServicepublic float nextFloat(float upperBound)
NumberServiceupperBound (exclusive)nextFloat in interface NumberServicepublic float nextFloat(float lowerBound,
float upperBound)
NumberServicelowerBound and upperBound (inclusive)nextFloat in interface NumberServiceCopyright © 2021. All rights reserved.