public class RandomSample
extends java.lang.Object
Constructor and Description |
---|
RandomSample(double[] pmf_in)
Initialises the random sampling from a given array of probability distribution.
|
RandomSample(ProbDist pd)
Initialises the random sampling from a given probability distribution.
|
Modifier and Type | Method and Description |
---|---|
double |
drawFrom()
Draws and returns a single value randomly from a given array of PMF.
|
int |
indexOfValueDrawnFrom()
Draws and returns the index of a single value randomly from a given array of PMF.
|
public RandomSample(double[] pmf_in)
pmf_in
- array of PMFpublic RandomSample(ProbDist pd)
pd
- probability distributionpublic double drawFrom()
pmf
- array of PMFpublic int indexOfValueDrawnFrom()
pmf
- array of PMF