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 RandomService
public long nextLong()
nextLong
in interface NumberService
public boolean nextBoolean()
nextBoolean
in interface RandomService
public int nextInt()
nextInt
in interface NumberService
public 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 NumberService
public 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 NumberService
public 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 NumberService
public 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 NumberService
public double nextDouble()
nextDouble
in interface NumberService
public double nextDouble(double bound)
upperBound
(exclusive)nextDouble
in interface NumberService
public double nextDouble(double lowerBound, double upperBound)
lowerBound
(inclusive) and upperBound
(exclusive)nextDouble
in interface NumberService
public float nextFloat()
nextFloat
in interface NumberService
public float nextFloat(float upperBound)
upperBound
(exclusive)nextFloat
in interface NumberService
public float nextFloat(float lowerBound, float upperBound)
lowerBound
and upperBound
(inclusive)nextFloat
in interface NumberService
Copyright © 2020. All rights reserved.