Class HaltonSequence

java.lang.Object
net.finmath.randomnumbers.HaltonSequence
All Implemented Interfaces:
Serializable, RandomNumberGenerator

public class HaltonSequence extends Object implements RandomNumberGenerator
Implements a multi-dimensional Halton sequence (quasi random numbers) with the given bases.
Version:
1.0
Author:
Christian Fries
See Also:
  • Constructor Details

    • HaltonSequence

      public HaltonSequence(int[] base)
      Constructs a Halton sequence with the given bases. The bases should be integers without common divisor greater than 1, for example, prime numbers.
      Parameters:
      base - The array of base integers. The length of the array defines the dimension of the sequence.
  • Method Details

    • getNext

      public double[] getNext()
      Description copied from interface: RandomNumberGenerator
      Get the next sample vector of dimension n, where n is getDimension. An implementation has to be thread safe.
      Specified by:
      getNext in interface RandomNumberGenerator
      Returns:
      The next sample vector of dimension n, where n is getDimension.
    • getDimension

      public int getDimension()
      Description copied from interface: RandomNumberGenerator
      Get the sample vector dimension.
      Specified by:
      getDimension in interface RandomNumberGenerator
      Returns:
      The sample vector dimension n.
    • getHaltonNumber

      public double[] getHaltonNumber(long index)
    • getHaltonNumber

      public double getHaltonNumber(long index, int dimension)
    • getHaltonNumberForGivenBase

      public static double getHaltonNumberForGivenBase(long index, int base)
      Return a Halton number, sequence starting at index = 0, base > 1.
      Parameters:
      index - The index of the sequence.
      base - The base of the sequence. Has to be greater than one (this is not checked).
      Returns:
      The Halton number.