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 Details

    • ThinRNG

      public ThinRNG(RandomNumberGenerator rng, int m)
      Constructs a thinned RNG.
      Parameters:
      rng - an underlying RNG
      m - the number of items to draw from the underlying RNG for each draw
  • Method Details

    • nextDouble

      public double nextDouble()
      Description copied from interface: RandomNumberGenerator
      Get the next random double.
      Specified by:
      nextDouble in interface RandomNumberGenerator
      Returns:
      the next random number
    • seed

      public void seed(long... seeds)
      Description copied from interface: Seedable
      Seed the random number/vector/scenario generator to produce repeatable experiments.
      Specified by:
      seed in interface Seedable
      Parameters:
      seeds - the seeds