Package jsl.utilities.random.rvariable
Class ShiftedRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractRVariable
-
- jsl.utilities.random.rvariable.ShiftedRV
-
- All Implemented Interfaces:
java.util.function.DoubleSupplier
,GetNameIfc
,GetValueIfc
,IdentityIfc
,PreviousValueIfc
,RandomIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,NewAntitheticInstanceIfc
,RVariableIfc
,SampleIfc
public final class ShiftedRV extends AbstractRVariable
Shifts the generated value of the supplied random variable by the shift amount. The shift amount must be positive.
-
-
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 ShiftedRV(double shift, RVariableIfc rv)
Uses a stream from the default stream factoryShiftedRV(double shift, RVariableIfc rv, int streamNum)
ShiftedRV(double shift, RVariableIfc rv, RNStreamIfc rng)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
generate()
RVariableIfc
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
-
ShiftedRV
public ShiftedRV(double shift, RVariableIfc rv)
Uses a stream from the default stream factory- Parameters:
shift
- a non-negative valuerv
- the random variable to shift
-
ShiftedRV
public ShiftedRV(double shift, RVariableIfc rv, int streamNum)
- Parameters:
shift
- a non-negative valuerv
- the random variable to shiftstreamNum
- the stream number
-
ShiftedRV
public ShiftedRV(double shift, RVariableIfc rv, RNStreamIfc rng)
- Parameters:
shift
- a non-negative valuerv
- the random variable to shiftrng
- the generator to use
-
-
Method Detail
-
generate
protected double generate()
- Specified by:
generate
in classAbstractRVariable
- Returns:
- the randomly generated variate
-
newInstance
public RVariableIfc newInstance(RNStreamIfc rng)
- Parameters:
rng
- the RNStreamIfc to use- Returns:
- a new instance with same parameter values
-
-