net.finmath.randomnumbers.HaltonSequence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
/*
* (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
*
* Created on 21 May 2018
*/
package net.finmath.randomnumbers;
/**
* Implements a multi-dimensional Halton sequence (quasi random numbers) with the given bases.
*
* @author Christian Fries
* @version 1.0
*/
public class HaltonSequence implements RandomNumberGenerator {
private final int base[];
private int currentIndex = 0;
/**
* Constructs a Halton sequence with the given bases.
*
* The bases should be integers without common divisor greater than 1, for example, prime numbers.
*
* @param base The array of base integers. The length of the array defines the dimension of the sequence.
*/
public HaltonSequence(int[] base) {
for(int i=0; i 0) {
x += (index % base) * factor;
factor /= base;
index /= base;
}
return x;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy