org.encog.mathutil
public class LinearCongruentialGenerator extends Object
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.
|
Constructor and Description |
---|
LinearCongruentialGenerator(long theSeed)
Construct the default LCG.
|
LinearCongruentialGenerator(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() |
double |
nextDouble() |
long |
nextLong() |
double |
range(double min,
double max)
Generate a random number in the specified range.
|
void |
setSeed(long theSeed)
Set the seed value.
|
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 LinearCongruentialGenerator(long theSeed)
theSeed
- The seed to use.public LinearCongruentialGenerator(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 final double range(double min, double max)
min
- The minimum random number.max
- The maximum random number.public final void setSeed(long theSeed)
theSeed
- The seed value.Copyright © 2014. All Rights Reserved.