public class RandomVariable
extends java.lang.Object
Constructor and Description |
---|
RandomVariable()
This default constructor creates a new random variable with a normal
distribution and with the default name "X".
|
RandomVariable(Distribution d)
This special constructor creates a new random variable with a specified
probability distribution and the default name "X".
|
RandomVariable(Distribution d,
java.lang.String n)
This general constructor creates a new random variable with a specified
probability distribution and name.
|
Modifier and Type | Method and Description |
---|---|
Distribution |
getDistribution()
This method gets the probability distribution.
|
IntervalData |
getIntervalData()
Get the data distribution.
|
java.lang.String |
getName()
This method gets the name of the random variable.
|
double |
getValue()
This method gets the current value of the random variable.
|
void |
reset()
This method resets the data distribution.
|
void |
sample()
This method simulates a value of the probability distribution and assigns the value
to the data distribution.
|
void |
setDistribution(Distribution d)
This method assigns the probability distribution and create a corresponding
interval data distribution.
|
void |
setName(java.lang.String n)
This method assign a name to the random variable.
|
void |
setValue(double x)
This method assigns a value to the random variable.
|
double |
simulate()
This method simulates a value of the probability distribution, assigns the value
to the data distribution, and returns the value.
|
public RandomVariable(Distribution d, java.lang.String n)
d
- the probability distributionn
- the name of the variablepublic RandomVariable(Distribution d)
d
- the probability distributionpublic RandomVariable()
public void setDistribution(Distribution d)
d
- the probability distributionpublic Distribution getDistribution()
public IntervalData getIntervalData()
public void setValue(double x)
public double getValue()
public void sample()
public double simulate()
public void reset()
public java.lang.String getName()
public void setName(java.lang.String n)
n
- the name of the random variable