Class EnumeratedDistribution.Sampler
java.lang.Object
org.apache.commons.math4.distribution.EnumeratedDistribution.Sampler
- Enclosing class:
- EnumeratedDistribution<T>
public class EnumeratedDistribution.Sampler
extends java.lang.Object
Sampler functionality.
-
Method Details
-
sample
Generates a random value sampled from this distribution.- Returns:
- a random value.
-
sample
Generates a random sample from the distribution.- Parameters:
sampleSize- the number of random values to generate.- Returns:
- an array representing the random sample.
- Throws:
NotStrictlyPositiveException- ifsampleSizeis not positive.
-
sample
Generates a random sample from the distribution.If the requested samples fit in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.
- Parameters:
sampleSize- the number of random values to generate.array- the array to populate.- Returns:
- an array representing the random sample.
- Throws:
NotStrictlyPositiveException- ifsampleSizeis not positive.NullArgumentException- ifarrayis null
-