All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.randomnumbers.MersenneTwister Maven / Gradle / Ivy

/*
 * (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
 *
 * Created on 17.06.2016
 */

package net.finmath.randomnumbers;

import java.io.Serializable;

/**
 * @author Christian Fries
 *
 */
public class MersenneTwister implements Serializable {

	private static final long serialVersionUID = -1827470318370174186L;

	private final org.apache.commons.math3.random.MersenneTwister mersenneTwister;
	
	public MersenneTwister(long seed) {
			mersenneTwister	= new org.apache.commons.math3.random.MersenneTwister((long)seed);
	}

	/**
	 * Returns the next random number in the sequence.
	 * 
	 * @return The next random number in the sequence.
	 */
	public double nextDouble() {
		return mersenneTwister.nextDouble();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy