Class BinomialIntegerRV

All Implemented Interfaces:
Cloneable, RandomVariableOps<Integer>

public class BinomialIntegerRV extends IntegerRandomVariable
Integer-valued random variable that generates a binomial distribution for n tries. Each number in the sequence represents the number of successful tries out of n tries.
  • Constructor Details

    • BinomialIntegerRV

      public BinomialIntegerRV(double prob, int n) throws IllegalArgumentException
      Constructor.
      Parameters:
      prob - the probability that a try is successful.
      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 try succeeds
    • getN

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

      public Integer 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<Integer>
      Specified by:
      next in class RandomVariable<Integer>
      Returns:
      the next value