org.encog.mathutil.randomize.generate
public class LinearCongruentialRandom extends AbstractBoxMuller
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_INC
Default inc.
|
static long |
DEFAULT_MOD1
First part of default mod.
|
static long |
DEFAULT_MOD2
Second part of default mod.
|
static long |
DEFAULT_MULT
Default mult.
|
static long |
MAX_RAND
The maximum rand number that the standard GCC based LCG will generate.
|
MU
Constructor and Description |
---|
LinearCongruentialRandom()
Constructor to use a seed equal to system time.
|
LinearCongruentialRandom(long theSeed)
Construct the default LCG.
|
LinearCongruentialRandom(long theModulus,
long theMultiplier,
long theIncrement,
long theSeed)
Create a LCG with the specified modulus, multiplier and increment.
|
Modifier and Type | Method and Description |
---|---|
long |
getIncrement() |
long |
getModulus() |
long |
getMultiplier() |
long |
getSeed() |
boolean |
nextBoolean() |
double |
nextDouble() |
float |
nextFloat() |
int |
nextInt() |
long |
nextLong() |
nextGaussian
nextDouble, nextDouble, nextInt, nextInt
public static final long DEFAULT_MOD1
public static final long DEFAULT_MOD2
public static final long DEFAULT_MULT
public static final long DEFAULT_INC
public static final long MAX_RAND
public LinearCongruentialRandom(long theSeed)
theSeed
- The seed to use.public LinearCongruentialRandom()
public LinearCongruentialRandom(long theModulus, long theMultiplier, long theIncrement, long theSeed)
theModulus
- The modulus for the LCG algorithm.theMultiplier
- The multiplier for the LCG algorithm.theIncrement
- The increment for the LCG algorithm.theSeed
- The seed for the LCG algorithm. Using the same seed will give
the same random number sequence each time, whether in Java or
DotNet.public final long getIncrement()
public final long getModulus()
public final long getMultiplier()
public final long getSeed()
public final double nextDouble()
public final long nextLong()
public boolean nextBoolean()
public float nextFloat()
public int nextInt()
Copyright © 2014. All Rights Reserved.