|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.encog.mathutil.LinearCongruentialGenerator
public class LinearCongruentialGenerator
A predictable random number generator. This is useful for unit tests and benchmarks where we want random numbers, but we want them to be the same each time. This class exists on both Java and C# so it can even provide consistent random numbers over the two platforms. Random numbers are created using a LCG. http://en.wikipedia.org/wiki/Linear_congruential_generator
| Field Summary | |
|---|---|
static long |
MAX_RAND
The maximum rand number that the standard GCC based LCG will generate. |
| Constructor Summary | |
|---|---|
LinearCongruentialGenerator(long seed)
Construct the default LCG. |
|
LinearCongruentialGenerator(long modulus,
long multiplier,
long increment,
long seed)
Create a LCG with the specified modulus, multiplier and increment. |
|
| Method Summary | |
|---|---|
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 seed)
Set the seed value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long MAX_RAND
| Constructor Detail |
|---|
public LinearCongruentialGenerator(long seed)
seed - The seed to use.
public LinearCongruentialGenerator(long modulus,
long multiplier,
long increment,
long seed)
modulus - The modulus for the LCG algorithm.multiplier - The multiplier for the LCG algorithm.increment - The increment for the LCG algorithm.seed - The seed for the LCG algorithm. Using the same seed will give
the same random number sequence each time, whether in Java or
DotNet.| Method Detail |
|---|
public long getIncrement()
public long getModulus()
public long getMultiplier()
public long getSeed()
public double nextDouble()
public long nextLong()
public double range(double min,
double max)
min - The minimum random number.max - The maximum random number.
public void setSeed(long seed)
seed - The seed value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||