Package org.drip.measure.crng
Class LinearCongruentialGenerator
java.lang.Object
org.drip.measure.crng.RandomNumberGenerator
org.drip.measure.crng.LinearCongruentialGenerator
public class LinearCongruentialGenerator extends RandomNumberGenerator
LinearCongruentialGenerator implements a RNG based on Recurrence Based on Modular Integer
Arithmetic.
- Module = Computational Core Module
- Library = Numerical Analysis Library
- Project = Rd Continuous/Discrete Probability Measures
- Package = Continuous Random Number Stream Generator
- Author:
- Lakshmi Krishnamurthy
-
Constructor Summary
Constructors Constructor Description LinearCongruentialGenerator(long lA, long lB, long lM, RecursiveGenerator rg)LinearCongruentialGenerator Contructor -
Method Summary
Modifier and Type Method Description longa()Retrieve Alongb()Retrieve Blongm()Retrieve Mstatic LinearCongruentialGeneratorMRG32k3a(long lA, long lB, long lM)Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3adoublenextDouble()Retrieve a Random Number between -1 and 1doublenextDouble01()Retrieve a Random Number between 0 and 1longnextLong()Retrieve the Next Pseudo-random Longstatic LinearCongruentialGeneratorNumericalRecipes(RecursiveGenerator rg)Construct a NumericalRecipes Version of LinearCongruentialGeneratorRecursiveGeneratorrecursiveGenerator()Retrieve the Recursive Generator InstanceMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LinearCongruentialGenerator
public LinearCongruentialGenerator(long lA, long lB, long lM, RecursiveGenerator rg) throws java.lang.ExceptionLinearCongruentialGenerator Contructor- Parameters:
lA- AlB- BlM- Mrg- The MultipleRecursiveGenerator Instance- Throws:
java.lang.Exception- Thrown if the Inputs are Invalid
-
-
Method Details
-
MRG32k3a
Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a- Parameters:
lA- AlB- BlM- M- Returns:
- Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
-
NumericalRecipes
Construct a NumericalRecipes Version of LinearCongruentialGenerator- Parameters:
rg- The Recursive Generator Instance- Returns:
- NumericalRecipes Version of LinearCongruentialGenerator
-
a
public long a()Retrieve A- Returns:
- A
-
b
public long b()Retrieve B- Returns:
- B
-
m
public long m()Retrieve M- Returns:
- M
-
recursiveGenerator
Retrieve the Recursive Generator Instance- Returns:
- The Recursive Generator Instance
-
nextLong
public long nextLong()Retrieve the Next Pseudo-random Long- Returns:
- The Next Pseudo-random Long
-
nextDouble
public double nextDouble()Retrieve a Random Number between -1 and 1- Returns:
- Random Number between -1 and 1
-
nextDouble01
public double nextDouble01()Description copied from class:RandomNumberGeneratorRetrieve a Random Number between 0 and 1- Overrides:
nextDouble01in classRandomNumberGenerator- Returns:
- Random Number between 0 and 1
-