java.lang.Object
org.bzdev.math.rv.RandomVariable<Integer>
org.bzdev.math.rv.IntegerRandomVariable
org.bzdev.math.rv.BinomialIntegerRV
- All Implemented Interfaces:
Cloneable,RandomVariableOps<Integer>
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 Summary
Constructors -
Method Summary
Methods inherited from class org.bzdev.math.rv.IntegerRandomVariable
clearRangeTest, getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumSMethods inherited from class org.bzdev.math.rv.RandomVariable
clone, getCharacteristics
-
Constructor Details
-
BinomialIntegerRV
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
Description copied from class:RandomVariableGet the next value for a random variable. In general, each value will be independent of the last.- Specified by:
nextin interfaceRandomVariableOps<Integer>- Specified by:
nextin classRandomVariable<Integer>- Returns:
- the next value
-