Package jsl.utilities.random.rvariable
Class MixtureRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.MixtureRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
,RandomIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,NewAntitheticInstanceIfc
,RVariableIfc
,SampleIfc
public final class MixtureRV extends AbstractRVariable
-
-
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 MixtureRV(java.util.List<RVariableIfc> list, double[] cdf)
MixtureRV(java.util.List<RVariableIfc> list, double[] cdf, int streamNum)
MixtureRV(java.util.List<RVariableIfc> list, double[] cdf, RNStreamIfc stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
generate()
MixtureRV
newInstance(RNStreamIfc rng)
-
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, toString, 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
-
MixtureRV
public MixtureRV(java.util.List<RVariableIfc> list, double[] cdf)
- Parameters:
list
- a list holding the random variables to select fromcdf
- the cumulative probability associated with each element of the list
-
MixtureRV
public MixtureRV(java.util.List<RVariableIfc> list, double[] cdf, int streamNum)
- Parameters:
list
- a list holding the random variables to select fromcdf
- the cumulative probability associated with each element of the liststreamNum
- the stream number
-
MixtureRV
public MixtureRV(java.util.List<RVariableIfc> list, double[] cdf, RNStreamIfc stream)
- Parameters:
list
- a list holding the random variables to select fromcdf
- the cumulative probability associated with each element of the liststream
- the source of the randomness- Throws:
java.lang.NullPointerException
- if stream is null
-
-
Method Detail
-
generate
protected double generate()
- Specified by:
generate
in classAbstractRVariable
- Returns:
- the randomly generated variate
-
newInstance
public MixtureRV newInstance(RNStreamIfc rng)
- Parameters:
rng
- the RNStreamIfc to use- Returns:
- a new instance with same parameter values
-
-