Class FourTapRandom
- java.lang.Object
-
- java.util.Random
-
- org.spaceroots.mantissa.random.FourTapRandom
-
- All Implemented Interfaces:
- java.io.Serializable
public class FourTapRandom extends java.util.RandomThis class implements a powerful pseudo-random number generator studied by Robert M Ziff.This generator belongs to the family of Generalized Feedback Shift-Register (GFSR) generators, but uses four feedback taps instead of two, thus greatly improving their quality for Monte-Carlo simulations.
This generator is described in a paper by Robert M. Ziff in 1997: Four-tap shift-register-sequence random-number generators, it is generator 9f (defined as
R(471, 1586, 6988, 9689)) of the paper. It has been kindly contributed to mantissa by Bill Maier.The class is implemented as a specialization of the standard
java.util.Randomclass. This allows to use it in algorithms expecting a standard random generator, and hence benefit from a better generator without code change.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description FourTapRandom()Creates a new random number generator.FourTapRandom(long seed)Creates a new random number generator using a single long seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidsetSeed(long seed)Reinitialize the generator as if just built with the given seed.
-
-
-
Constructor Detail
-
FourTapRandom
public FourTapRandom()
Creates a new random number generator.The instance is initialized using the current time as the seed.
-
FourTapRandom
public FourTapRandom(long seed)
Creates a new random number generator using a single long seed.- Parameters:
seed- the initial seed
-
-
DataMelt 3.0 © DataMelt by jWork.ORG