public class LinearCongruentialRandomGenerator extends java.lang.Object implements UniformRandomGenerator
desmoj.dist.UniformRandomGenerator
interface. All
Distributions
in this package use this random generator by
default. The implementation is based on the Java API
java.util.Random
class' random generator. The Java API Random
class uses a 48-bit seed as input to the linear congruential formula. (See
Donald Knuth, The Art of Computer Programming, Volume 2, Section 3.2.1.)UniformRandomGenerator
,
Distribution
,
Random
Constructor and Description |
---|
LinearCongruentialRandomGenerator()
Creates a DefaultrandomGenerator with seed 42.
|
LinearCongruentialRandomGenerator(long seed)
Creates a DefaultrandomGenerator with given value as initial seed.
|
Modifier and Type | Method and Description |
---|---|
double |
nextDouble()
Returns the next pseudo random uniform [0,1] distributed double value
from the stream produced by the underlying pseudo random number
generator.
|
void |
setSeed(long newSeed)
Sets the seed for the pseudo random number generator.
|
public LinearCongruentialRandomGenerator()
public LinearCongruentialRandomGenerator(long seed)
seed
- long : The initial seed of the underlying pseudo random
generatorpublic double nextDouble()
nextDouble
in interface UniformRandomGenerator
public void setSeed(long newSeed)
setSeed
in interface UniformRandomGenerator
newSeed
- long : The new initial seed value for the pseudo random number
generator