public class MixedVariate extends RandomVariateBase
Modifier and Type | Field and Description |
---|---|
private RandomVariate[] |
distributions
The RandomVariates to mix.
|
private DiscreteVariate |
mixing
A DiscreteVariate used to choose a RandomVariate with the desired
probability.
|
rng
Constructor and Description |
---|
MixedVariate()
Creates new MixedVariate with no RandomVariates.
|
Modifier and Type | Method and Description |
---|---|
protected RandomVariate[] |
deepCopy(RandomVariate[] live) |
double |
generate()
Generate a random variate having this class's distribution.
|
RandomVariate[] |
getDistributions() |
double[] |
getMixingProbs() |
java.lang.Object[] |
getParameters()
Returns a two element array that contains the mixing DiscreteVariate
and a RandomVariate array containing the distributions to mix.
|
void |
setDistributions(RandomVariate[] dist) |
void |
setMixingProbs(double[] mixProbs)
The "probabilities" can in fact be frequencies.
|
void |
setParameters(java.lang.Object... params)
Sets the probabilities and distributions that define this RandomVariate.
|
java.lang.String |
toString()
Returns a String containing list of the mixing probabilities and distributions.
|
getRandomNumber, setRandomNumber
private DiscreteVariate mixing
private RandomVariate[] distributions
public MixedVariate()
public void setMixingProbs(double[] mixProbs)
mixProbs
- Mixing probabilitiespublic double[] getMixingProbs()
public void setDistributions(RandomVariate[] dist)
dist
- RandomVariate[] array to be mixedpublic RandomVariate[] getDistributions()
public double generate()
public java.lang.Object[] getParameters()
public void setParameters(java.lang.Object... params)
params
- A two element array. The first element is a double array
containing the mixing probability for each RandomVariate. The second
element is a RandomVariate array containing the RandomVariates to mix.java.lang.IllegalArgumentException
- If the given array does not contain 2 elements,
or the first element is not a double[], or the second element is not
a RandomVariate[], or the two arrays are not the same length.protected RandomVariate[] deepCopy(RandomVariate[] live)
live
- array of RandomVariatespublic java.lang.String toString()
toString
in class java.lang.Object