Package jsl.utilities.random.rvariable
Class GeometricRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.GeometricRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier,GetNameIfc,GetValueIfc,IdentityIfc,PreviousValueIfc,RandomIfc,GetRandomNumberStreamIfc,RNStreamControlIfc,SetRandomNumberStreamIfc,NewAntitheticInstanceIfc,RVariableIfc,SampleIfc
public final class GeometricRV extends AbstractRVariable
Geometric(probability of success) random variable, range 0, 1, 2, etc.
-
-
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 GeometricRV(double prob)GeometricRV(double prob, int streamNum)GeometricRV(double prob, RNStreamIfc stream)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected doublegenerate()doublegetProbabilityOfSuccess()Gets the success probabilitystatic RVControlsmakeControls()The key is "ProbOfSuccess", the default value is 0.5GeometricRVnewInstance(RNStreamIfc stream)java.lang.StringtoString()-
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
-
GeometricRV
public GeometricRV(double prob)
- Parameters:
prob- probability of success, must be in range (0,1)
-
GeometricRV
public GeometricRV(double prob, int streamNum)- Parameters:
prob- probability of success, must be in range (0,1)streamNum- the stream number to use
-
GeometricRV
public GeometricRV(double prob, RNStreamIfc stream)- Parameters:
prob- probability of success, must be in range (0,1)stream- the random number stream to use
-
-
Method Detail
-
newInstance
public GeometricRV newInstance(RNStreamIfc stream)
- Parameters:
stream- the random number stream to use- Returns:
- a new instance with same parameter value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getProbabilityOfSuccess
public double getProbabilityOfSuccess()
Gets the success probability- Returns:
- The success probability
-
generate
protected double generate()
- Specified by:
generatein classAbstractRVariable- Returns:
- the randomly generated variate
-
makeControls
public static RVControls makeControls()
The key is "ProbOfSuccess", the default value is 0.5- Returns:
- a control for Geometric random variables
-
-