public class DefaultRandomService extends Object implements RandomService
| Constructor and Description |
|---|
DefaultRandomService() |
DefaultRandomService(Long seed) |
| Modifier and Type | Method and Description |
|---|---|
long |
getSeed() |
boolean |
nextBoolean()
Generates a random boolean
|
double |
nextDouble()
Generates a random positive double
|
double |
nextDouble(double bound)
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 double 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()
getSeed in interface RandomServicepublic long nextLong()
nextLong in interface NumberServicepublic boolean nextBoolean()
nextBoolean in interface RandomServicepublic int nextInt()
nextInt in interface NumberServicepublic int nextInt(int upperBound)
upperBound (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)
lowerBound 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)
upperBound (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)
upperBound (inclusive)
If upperBound equals Long.MAX_VALUE generates a random long between
lowerBound (inclusive) and upperBound (exclusive).
nextLong in interface NumberServicepublic double nextDouble()
nextDouble in interface NumberServicepublic double nextDouble(double bound)
upperBound (exclusive)nextDouble in interface NumberServicepublic double nextDouble(double lowerBound,
double upperBound)
lowerBound (inclusive) and upperBound (exclusive)nextDouble in interface NumberServicepublic float nextFloat()
nextFloat in interface NumberServicepublic float nextFloat(float upperBound)
upperBound (exclusive)nextFloat in interface NumberServicepublic float nextFloat(float lowerBound,
float upperBound)
lowerBound and upperBound (inclusive)nextFloat in interface NumberServiceCopyright © 2020. All rights reserved.