Package jasima.core.random.discrete
Class IntBinomial
- java.lang.Object
-
- jasima.core.random.continuous.DblSequence
-
- jasima.core.random.discrete.IntSequence
-
- jasima.core.random.discrete.IntDistribution
-
- jasima.core.random.discrete.IntBinomial
-
- All Implemented Interfaces:
Serializable,Cloneable
public class IntBinomial extends IntDistribution
This class implements a discrete number stream following a Binomial distribution. It has two parameters, the probability of success (in a single trial) and the total number of trials conducted.- Author:
- Torsten Hildebrandt
- See Also:
- Binomial distribution (Wikipedia), Binomial distribution (MathWorld), Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.random.continuous.DblSequence
rndGen
-
-
Constructor Summary
Constructors Constructor Description IntBinomial()IntBinomial(int n, double p)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumTrials()doublegetProbabilityOfSuccess()protected voidsetDistribution(org.apache.commons.math3.distribution.IntegerDistribution distribution)Sets the discrete distribution to use.voidsetNumTrials(int numTrials)Sets the number of trails of the Bernoulli experiment.voidsetProbabilityOfSuccess(double probOfSuccess)Sets the probability of success in a single trial.StringtoString()-
Methods inherited from class jasima.core.random.discrete.IntDistribution
getDistribution, getNumericalMean, getValueRange, nextInt
-
Methods inherited from class jasima.core.random.discrete.IntSequence
clone, nextDbl
-
Methods inherited from class jasima.core.random.continuous.DblSequence
createStreamDefFromStream, getName, getRndGen, init, max, min, setName, setRndGen
-
-
-
-
Method Detail
-
setDistribution
protected void setDistribution(org.apache.commons.math3.distribution.IntegerDistribution distribution)
Description copied from class:IntDistributionSets the discrete distribution to use.- Overrides:
setDistributionin classIntDistribution
-
toString
public String toString()
- Overrides:
toStringin classIntDistribution
-
getProbabilityOfSuccess
public double getProbabilityOfSuccess()
-
setProbabilityOfSuccess
public void setProbabilityOfSuccess(double probOfSuccess) throws org.apache.commons.math3.exception.OutOfRangeExceptionSets the probability of success in a single trial.- Parameters:
probOfSuccess- The success probability.- Throws:
org.apache.commons.math3.exception.OutOfRangeException- If the supplied probability is not in the interval[0,1].
-
getNumTrials
public int getNumTrials()
-
setNumTrials
public void setNumTrials(int numTrials) throws org.apache.commons.math3.exception.NotPositiveExceptionSets the number of trails of the Bernoulli experiment.- Parameters:
numTrials- The number of trials.- Throws:
org.apache.commons.math3.exception.NotPositiveException- If the supplied value was negative.
-
-