Class BinomialDoubleRV

All Implemented Interfaces:
Cloneable, RandomVariableOps<Double>

public class BinomialDoubleRV extends DoubleRandomVariable
Double-valued random variable that generates a binomial distribution for n tries. Each number in the sequence represents the number of tries that succeeded out of n tries. The random numbers that are returned will be rounded to the nearest integral values as long as they are small enough so that StrictMath.rint((double)n) = n where n is a long integer.
  • Constructor Details

    • BinomialDoubleRV

      public BinomialDoubleRV(double prob, double n) throws IllegalArgumentException
      Constructor. The argument n will be rounded to the nearest integral value.
      Parameters:
      prob - the probability that a try succeeds.
      n - the number of tries (must be positive)
      Throws:
      IllegalArgumentException
  • Method Details

    • getProb

      public double getProb()
      Get the probability that a try succeeds
      Returns:
      the probability that a a try succeeds
    • getN

      public double getN()
      Get the number of tries for this random variable.
      Returns:
      the number of tries
    • next

      public Double next()
      Description copied from class: RandomVariable
      Get the next value for a random variable. In general, each value will be independent of the last.
      Specified by:
      next in interface RandomVariableOps<Double>
      Specified by:
      next in class RandomVariable<Double>
      Returns:
      the next value