Class ThinRNG
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.ThinRNG
-
- All Implemented Interfaces:
RandomNumberGenerator,Seedable
public class ThinRNG extends Object implements RandomNumberGenerator
Thinning is a scheme that returns every m-th item, discarding the last m-1 items for each draw. This usually helps reduce serial correlation.
-
-
Constructor Summary
Constructors Constructor Description ThinRNG(RandomNumberGenerator rng, int m)Constructs a thinned RNG.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublenextDouble()Get the next randomdouble.voidseed(long... seeds)Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
ThinRNG
public ThinRNG(RandomNumberGenerator rng, int m)
Constructs a thinned RNG.- Parameters:
rng- an underlying RNGm- the number of items to draw from the underlying RNG for each draw
-
-
Method Detail
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGeneratorGet the next randomdouble.- Specified by:
nextDoublein interfaceRandomNumberGenerator- Returns:
- the next random number
-
-