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.

Author:
Lakshmi Krishnamurthy
  • Constructor Details

    • LinearCongruentialGenerator

      public LinearCongruentialGenerator​(long lA, long lB, long lM, RecursiveGenerator rg) throws java.lang.Exception
      LinearCongruentialGenerator Contructor
      Parameters:
      lA - A
      lB - B
      lM - M
      rg - The MultipleRecursiveGenerator Instance
      Throws:
      java.lang.Exception - Thrown if the Inputs are Invalid
  • Method Details

    • MRG32k3a

      public static final LinearCongruentialGenerator MRG32k3a​(long lA, long lB, long lM)
      Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
      Parameters:
      lA - A
      lB - B
      lM - M
      Returns:
      Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a
    • NumericalRecipes

      public static final LinearCongruentialGenerator NumericalRecipes​(RecursiveGenerator rg)
      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

      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()
      Description copied from class: RandomNumberGenerator
      Retrieve a Random Number between 0 and 1
      Overrides:
      nextDouble01 in class RandomNumberGenerator
      Returns:
      Random Number between 0 and 1