Package jasima.core.random.discrete
Class IntBernoulli
- java.lang.Object
-
- jasima.core.random.continuous.DblSequence
-
- jasima.core.random.discrete.IntSequence
-
- jasima.core.random.discrete.IntBernoulli
-
- All Implemented Interfaces:
Serializable,Cloneable
public class IntBernoulli extends IntSequence
This class implements a discrete number stream following a Bernoulli distribution. This means, it contains the value0with a probability of1-probabilityOfSuccessand the value1with a probability ofprobabilityOfSuccess.- Author:
- Torsten Hildebrandt
- See Also:
- Bernoulli distribution (Wikipedia), Bernoulli distribution (MathWorld), Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.random.continuous.DblSequence
rndGen
-
-
Constructor Summary
Constructors Constructor Description IntBernoulli()IntBernoulli(double probabilityOfSuccess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetNumericalMean()Returns the arithmetic mean of the values returned byDblSequence.nextDbl().doublegetProbabilityOfSuccess()Pair<Double,Double>getValueRange()This method computes the minimum and maximum support values (range of possible values) of this stream.intnextInt()voidsetProbabilityOfSuccess(double probOfSuccess)Sets the probability of success.StringtoString()-
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
-
nextInt
public int nextInt()
- Specified by:
nextIntin classIntSequence
-
getNumericalMean
public double getNumericalMean()
Description copied from class:DblSequenceReturns the arithmetic mean of the values returned byDblSequence.nextDbl().- Overrides:
getNumericalMeanin classDblSequence
-
getValueRange
public Pair<Double,Double> getValueRange()
Description copied from class:DblSequenceThis method computes the minimum and maximum support values (range of possible values) of this stream.- Overrides:
getValueRangein classDblSequence- Returns:
- A
Paircontaining the minimum and maximum support values.
-
getProbabilityOfSuccess
public double getProbabilityOfSuccess()
-
setProbabilityOfSuccess
public void setProbabilityOfSuccess(double probOfSuccess) throws org.apache.commons.math3.exception.OutOfRangeExceptionSets the probability of success.- Parameters:
probOfSuccess- The success probability.- Throws:
org.apache.commons.math3.exception.OutOfRangeException- If the supplied probability is not in the interval[0,1].
-
-