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
    long a()
    Retrieve A
    long b()
    Retrieve B
    long m()
    Retrieve M
    static LinearCongruentialGenerator MRG32k3a​(long a, long b, long m)
    Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
    double nextDouble()
    Retrieve a Random Number between -1 and 1
    double nextDouble01()
    Retrieve a Random Number between 0 and 1
    long nextLong()
    Retrieve the Next Pseudo-random Long
    static LinearCongruentialGenerator NumericalRecipes​(RecursiveGenerator recursiveGenerator)
    Construct the Numerical Recipes Version of LinearCongruentialGenerator
    RecursiveGenerator recursiveGenerator()
    Retrieve the Recursive Generator Instance

    Methods 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.Exception
      LinearCongruentialGenerator Constructor
      Parameters:
      a - A
      b - B
      m - M
      recursiveGenerator - Recursive Generator Instance
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
  • Method Details

    • MRG32k3a

      public static final LinearCongruentialGenerator MRG32k3a​(long a, long b, long m)
      Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
      Parameters:
      a - A
      b - B
      m - 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

      public RecursiveGenerator 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:
      nextDouble01 in class RandomNumberGenerator
      Returns:
      Random Number between 0 and 1