Class BinomialRNG

java.lang.Object
dev.nm.stat.random.rng.univariate.BinomialRNG
All Implemented Interfaces:
RandomNumberGenerator, Seedable

public class BinomialRNG extends Object implements RandomNumberGenerator
This random number generator samples from the binomial distribution.

The R equivalent class are dbinom, pbinom, qbinom, rbinom.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    BinomialRNG(int n, double p)
    Construct a random number generator to sample from the binomial distribution.
    BinomialRNG(int n, double p, RandomLongGenerator uniform)
    Construct a random number generator to sample from the binomial distribution.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the next random double.
    void
    seed(long... seeds)
    Seed the random number/vector/scenario generator to produce repeatable experiments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BinomialRNG

      public BinomialRNG(int n, double p, RandomLongGenerator uniform)
      Construct a random number generator to sample from the binomial distribution.
      Parameters:
      n - the number of trials, a natural number
      p - the success probability in each trial, [0, 1]
      uniform - a uniform random number generator
    • BinomialRNG

      public BinomialRNG(int n, double p)
      Construct a random number generator to sample from the binomial distribution.
      Parameters:
      n - the number of trials, a natural number
      p - the success probability in each trial, [0, 1]
  • Method Details

    • 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
    • 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