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. It provides the following Functionality:
- Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
- Construct a NumericalRecipes Version of LinearCongruentialGenerator
- LinearCongruentialGenerator Constructor
- Retrieve A
- Retrieve B
- Retrieve M
- Retrieve the Recursive Generator Instance
- Retrieve the Next Pseudo-random Long
- Retrieve a Random Number between -1 and 1
- Retrieve a Random Number between 0 and 1
| 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 a, long b, long m, RecursiveGenerator recursiveGenerator)LinearCongruentialGenerator Constructor -
Method Summary
Modifier and Type Method Description longa()Retrieve Alongb()Retrieve Blongm()Retrieve Mstatic LinearCongruentialGeneratorMRG32k3a(long a, long b, long m)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 recursiveGenerator)Construct the Numerical Recipes 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 a, long b, long m, RecursiveGenerator recursiveGenerator) throws java.lang.ExceptionLinearCongruentialGenerator Constructor- Parameters:
a- Ab- Bm- MrecursiveGenerator- Recursive Generator 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:
a- Ab- Bm- M- Returns:
- Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
-
NumericalRecipes
public static final LinearCongruentialGenerator NumericalRecipes(RecursiveGenerator recursiveGenerator)Construct the Numerical Recipes Version of LinearCongruentialGenerator- Parameters:
recursiveGenerator- The Recursive Generator Instance- Returns:
- Numerical Recipes 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()Retrieve a Random Number between 0 and 1- Overrides:
nextDouble01in classRandomNumberGenerator- Returns:
- Random Number between 0 and 1
-