Package jsl.utilities.random.rvariable
Class NormalRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.NormalRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
,RandomIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,NewAntitheticInstanceIfc
,RVariableIfc
,SampleIfc
public final class NormalRV extends AbstractRVariable
Normal(mean, variance)
-
-
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 NormalRV()
N(0,1)NormalRV(double mean, double variance)
NormalRV(double mean, double variance, int streamNum)
NormalRV(double mean, double variance, RNStreamIfc rng)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
generate()
double
getMean()
double
getStandardDeviation()
double
getVariance()
static RVControls
makeControls()
The keys are "mean" with default value 0.0 and "variance" with default value 1.0NormalRV
newInstance(RNStreamIfc rng)
double
polarMethodRandomVariate()
Gets a random variate from this normal distribution via the polar method.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
-
NormalRV
public NormalRV()
N(0,1)
-
NormalRV
public NormalRV(double mean, double variance)
-
NormalRV
public NormalRV(double mean, double variance, int streamNum)
-
NormalRV
public NormalRV(double mean, double variance, RNStreamIfc rng)
-
-
Method Detail
-
newInstance
public NormalRV 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
-
getMean
public double getMean()
- Returns:
- mean of the random variable
-
getVariance
public double getVariance()
- Returns:
- variance of the random variable
-
getStandardDeviation
public double getStandardDeviation()
- Returns:
- the standard deviation of the random variable
-
generate
protected double generate()
- Specified by:
generate
in classAbstractRVariable
- Returns:
- the randomly generated variate
-
makeControls
public static RVControls makeControls()
The keys are "mean" with default value 0.0 and "variance" with default value 1.0- Returns:
- a control for Normal random variables
-
polarMethodRandomVariate
public double polarMethodRandomVariate()
Gets a random variate from this normal distribution via the polar method.- Returns:
- a normally distributed random variate
-
-