public class ScaledVariate extends java.lang.Object implements RandomVariate
Modifier and Type | Field and Description |
---|---|
private RandomVariate |
rv
The instance of the underlying RandomVariate.
|
private double |
scale
The amount to scale the underlying RandomVariate by.
|
private double |
shift
The amount to shift the underlying RandomVariate by.
|
Constructor and Description |
---|
ScaledVariate()
Creates a new instance of ScaledVariate with zero shift and 1.0 scale.
|
Modifier and Type | Method and Description |
---|---|
double |
generate()
Generate a random variate having this class's distribution.
|
java.lang.Object[] |
getParameters()
Returns a 3 element array with the RandomVariate, scale and the shift as
Doubles.
|
RandomNumber |
getRandomNumber()
Returns the instance of the supporting RandomNumber.
|
RandomVariate |
getRandomVariate() |
double |
getScale() |
double |
getShift() |
void |
setParameters(java.lang.Object... params)
Sets the underlying RandomVariate, the scale, and the shift.
|
void |
setRandomNumber(RandomNumber rng)
Sets the supporting RandomNumber object
|
void |
setRandomVariate(RandomVariate rv) |
void |
setScale(double scale) |
void |
setShift(double shift) |
java.lang.String |
toString()
Returns a String with the scale, the shift, and information about the
underlying RandomVariate.
|
private RandomVariate rv
private double shift
private double scale
public ScaledVariate()
public double generate()
generate
in interface RandomVariate
public java.lang.Object[] getParameters()
getParameters
in interface RandomVariate
public void setParameters(java.lang.Object... params)
setParameters
in interface RandomVariate
params
- A 2 or 3 element array containing: The instance of the
underlying RandomVariate, the scale as a Number, and (optionally) the
shift as a Number.java.lang.IllegalArgumentException
- If the array does not have 2 or 3
elements, if the first element is not a RandomVariate, if either the 2nd
or 3rd (if specified) is not a Number, or if the scale is not positive.public RandomNumber getRandomNumber()
getRandomNumber
in interface RandomVariate
public void setRandomNumber(RandomNumber rng)
setRandomNumber
in interface RandomVariate
rng
- The RandomNumber instance supporting the generating algorithmpublic void setShift(double shift)
shift
- the amount to shift the RandomVariate.public double getShift()
public void setScale(double scale)
scale
- the amount to scale the RandomVariate by.public double getScale()
public void setRandomVariate(RandomVariate rv)
rv
- the underlying RandomVariate.public RandomVariate getRandomVariate()
public java.lang.String toString()
toString
in class java.lang.Object