java.lang.Object
org.bzdev.math.rv.RandomVariable<Double>
org.bzdev.math.rv.DoubleRandomVariable
org.bzdev.math.rv.BinomialDoubleRV
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<Double>
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 Summary
Constructors -
Method Summary
Methods inherited from class org.bzdev.math.rv.DoubleRandomVariable
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setMaximum, setMinimum, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximum, tightenMaximumS, tightenMinimum, tightenMinimumS
Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getCharacteristics
-
Constructor Details
-
BinomialDoubleRV
Constructor. The argumentn
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
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 interfaceRandomVariableOps<Double>
- Specified by:
next
in classRandomVariable<Double>
- Returns:
- the next value
-