|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.liv.prng.DiscreteProbabilityDistribution
A class representing a discrete probability distribution which can used to generate random events according to the specified distribution. The output from a uniform PRNG is used to to select from the different possible events.
| Nested Class Summary | |
class |
DiscreteProbabilityDistribution.ProbabilityError
|
| Field Summary | |
protected int |
k
The number of possible events for this distribution. |
protected double[] |
p
The probability distribution. |
| Constructor Summary | |
DiscreteProbabilityDistribution(int k)
Construct a new distribution with k possible events. |
|
| Method Summary | |
int |
computeMax()
Compute the maximum value of the random variable defined by this distribution. |
double |
computeMean()
Compute the expected value of the random variable defined by this distribution. |
int |
computeMin()
Compute the minimum value of the random variable defined by this distribution. |
void |
computeStats(CummulativeDistribution stats)
|
int |
generateRandomEvent()
Generate a random event according to the probability distribution. |
double |
getProbability(int i)
Get the probability of the ith event. |
java.lang.Object |
protoClone()
|
void |
reset()
Reinitialise our state to the original settings. |
void |
setProbability(int i,
double probability)
Set the probability of the ith event. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected double[] p
protected int k
| Constructor Detail |
public DiscreteProbabilityDistribution(int k)
k - The number of possible events for this random variable| Method Detail |
public java.lang.Object protoClone()
protoClone in interface Prototypeable
public void setProbability(int i,
double probability)
i - The eventprobability - The probability of event i occuringpublic double getProbability(int i)
i - The eventpublic int generateRandomEvent()
public void reset()
Resetable
reset in interface Resetablepublic double computeMean()
public int computeMin()
public int computeMax()
public void computeStats(CummulativeDistribution stats)
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||