Package jsl.utilities.random.rvariable
Class BinomialRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.BinomialRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
,RandomIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,NewAntitheticInstanceIfc
,RVariableIfc
,SampleIfc
public final class BinomialRV extends AbstractRVariable
BinomialRV(probability of success, number of trials)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jsl.utilities.random.rvariable.RVariableIfc
RVariableIfc.RVType
-
-
Field Summary
-
Fields inherited from class jsl.utilities.random.rvariable.AbstractRVariable
myRNStream
-
-
Constructor Summary
Constructors Constructor Description BinomialRV(double pSuccess, int numTrials)
BinomialRV(double pSuccess, int numTrials, int streamNum)
BinomialRV(double pSuccess, int numTrials, RNStreamIfc stream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
generate()
double
getProb()
Gets the success probabilityint
getTrials()
Gets the number of trialsstatic RVControls
makeControls()
The keys are "ProbOfSuccess", the default value is 0.5 and "NumTrials" with default value 2.BinomialRV
newInstance(RNStreamIfc rng)
java.lang.String
toString()
-
Methods inherited from class jsl.utilities.random.rvariable.AbstractRVariable
advanceToNextSubstream, getAntitheticOption, getId, getName, getPreviousValue, getRandomNumberStream, getValue, newAntitheticInstance, newInstance, resetStartStream, resetStartSubstream, sample, setAntitheticOption, setName, setPreviousValue, setRandomNumberStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsl.utilities.random.rng.GetRandomNumberStreamIfc
getStreamNumber
-
Methods inherited from interface jsl.utilities.random.rvariable.RVariableIfc
asDoubleStream, getAsDouble, getSumOfValues, newInstance
-
Methods inherited from interface jsl.utilities.random.rng.SetRandomNumberStreamIfc
setRandomNumberStream
-
-
-
-
Constructor Detail
-
BinomialRV
public BinomialRV(double pSuccess, int numTrials)
- Parameters:
pSuccess
- the probability of success, must be in (0,1)numTrials
- the number of trials, must be greater than 0
-
BinomialRV
public BinomialRV(double pSuccess, int numTrials, int streamNum)
- Parameters:
pSuccess
- the probability of success, must be in (0,1)numTrials
- the number of trials, must be greater than 0streamNum
- the stream number from the stream provider to use
-
BinomialRV
public BinomialRV(double pSuccess, int numTrials, RNStreamIfc stream)
- Parameters:
pSuccess
- the probability of success, must be in (0,1)numTrials
- the number of trials, must be greater than 0stream
- the stream from the stream provider to use
-
-
Method Detail
-
newInstance
public BinomialRV newInstance(RNStreamIfc rng)
- Parameters:
rng
- the RNStreamIfc to use- Returns:
- a new instance with same parameter value
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getProb
public double getProb()
Gets the success probability- Returns:
- The success probability
-
getTrials
public int getTrials()
Gets the number of trials- Returns:
- the number of trials
-
generate
protected double generate()
- Specified by:
generate
in classAbstractRVariable
- Returns:
- the randomly generated variate
-
makeControls
public static RVControls makeControls()
The keys are "ProbOfSuccess", the default value is 0.5 and "NumTrials" with default value 2. NumTrials is an Integer control and ProbOfSuccess is a Double control.- Returns:
- a control for Binomial random variables
-
-