Documentation of 'umontreal.iro.lecuyer.randvar.BinomialGen' Java class
BinomialGen
umontreal.iro.lecuyer.randvar

Class BinomialGen

  • Direct Known Subclasses:
    BinomialConvolutionGen


    public class BinomialGen
    extends RandomVariateGenInt
    This class implements random variate generators for the binomial distribution. It has parameters n and p with mass function

    p(x) = nCr(n, x)px(1 - p)n-x = n!/(x!(n - x)!)  px(1 - p)n-x        for x = 0, 1, 2,..., n

    where nCr(n, x) is the number of combinations of x objects among n, n is a positive integer, and 0 <= p <= 1.

    The (non-static) nextInt method simply calls inverseF on the distribution.

    • Constructor Detail

      • BinomialGen

        public BinomialGen(RandomStream s,
                           int n,
                           double p)
        Creates a binomial random variate generator with parameters n and p, using stream s.
      • BinomialGen

        public BinomialGen(RandomStream s,
                           BinomialDist dist)
        Creates a random variate generator for the binomial distribution dist and the random stream s.
    • Method Detail

      • nextInt

        public static int nextInt(RandomStream s,
                                  int n,
                                  double p)
        Generates a new integer from the binomial distribution with parameters n = n and p = p, using the given stream s.
      • getN

        public int getN()
        Returns the parameter n of this object.
      • getP

        public double getP()
        Returns the parameter p of this object.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.