public class Sequential extends java.lang.Object implements RandomNumber
Modifier and Type | Field and Description |
---|---|
private long |
index
The current value of the seed.
|
private static double |
MULTIPLIER |
Constructor and Description |
---|
Sequential()
Constructs a new Sequential that will the initial value set to 0.
|
Modifier and Type | Method and Description |
---|---|
double |
draw()
Generates the next value and scales it to between 0 and 1.
|
long |
drawLong()
Increments the seed and returns its new value.
|
double |
getMultiplier()
Returns the value to multiply a
long by to scale it to
between 0 and 1. |
long |
getSeed()
Returns the current seed.
|
long[] |
getSeeds()
Gets the value of the current seed.
|
void |
resetSeed()
Sets the current value to 0.
|
void |
setSeed(long seed)
Sets the value to the given number.
|
void |
setSeeds(long[] seed)
Sets the seed to the first element in the given array.
|
private static final double MULTIPLIER
private long index
public Sequential()
public void setSeed(long seed)
setSeed
in interface RandomNumber
seed
- The new random number seedpublic long getSeed()
getSeed
in interface RandomNumber
public void setSeeds(long[] seed)
setSeeds
in interface RandomNumber
seed
- The new array of seedspublic long[] getSeeds()
getSeeds
in interface RandomNumber
public void resetSeed()
resetSeed
in interface RandomNumber
public double draw()
Long.MAX_VALUE
draw
in interface RandomNumber
public long drawLong()
long
.drawLong
in interface RandomNumber
public double getMultiplier()
long
by to scale it to
between 0 and 1.getMultiplier
in interface RandomNumber