- java.lang.Object
- com.anylogic.engine.CustomDistributionAbstract<E>
- com.anylogic.engine.CustomDistributionOptions<E>
- All Implemented Interfaces:
Serializable
public class CustomDistributionOptions<E extends Enum<?>> extends CustomDistributionAbstract<E> implements Serializable
This class is used to generate random enum values from a probability density
function (PDF) defined as a set of values of any type with corresponding
rates. You can supply the values and rates directly as a Map, as two lists
with unique values and rates or as a list with non-unique values.
For more information how to use get() function and set the random number generator see .
For more information how to use get() function and set the random number generator see .
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
CustomDistributionOptions |
Constructs a custom empirical distribution from array with occurrences.
|
CustomDistributionOptions |
Constructs a custom empirical distribution from arrays of values and weights.
|
CustomDistributionOptions |
Constructs a custom empirical distribution from arrays of values and weights.
|
CustomDistributionOptions |
Constructs a custom empirical distribution from array with occurrences.
|
CustomDistributionOptions |
Constructs a custom empirical distribution from the given map with values and
weights.
|
CustomDistributionOptions |
Constructs a custom empirical distribution from the given map with values and
weights.
|
public CustomDistributionOptions(Map<E, Double> valuesWeightsMap)
Constructs a custom empirical distribution from the given map with values and
weights.
- Parameters:
valuesWeightsMap
- map with value, weight (non empty, no negative weights)
public CustomDistributionOptions(Map<E, Double> valuesWeightsMap, Random random)
Constructs a custom empirical distribution from the given map with values and
weights.
- Parameters:
valuesWeightsMap
- map with value, weight (non empty, no negative weights)random
- random number generator
public CustomDistributionOptions(E[] values, double[] weights)
Constructs a custom empirical distribution from arrays of values and weights.
- Parameters:
values
- the array of values (non empty, no duplicates) non-empty array with values without duplicatesweights
- the array of weights (same size as values, no negative weights)
public CustomDistributionOptions(E[] values, double[] weights, Random random)
Constructs a custom empirical distribution from arrays of values and weights.
- Parameters:
values
- the array of values (non empty, no duplicates) non-empty array with values without duplicatesweights
- the array of weights (same size as values, no negative weights)random
- random number generator
public CustomDistributionOptions(E[] values)
Constructs a custom empirical distribution from array with occurrences.
Number of value occurrences defines the weight of the value.
- Parameters:
values
- the array of values (non empty, could repeat and be non sorted)
public CustomDistributionOptions(E[] values, Random random)
Constructs a custom empirical distribution from array with occurrences.
Number of value occurrences defines the weight of the value.
- Parameters:
values
- the array of values (non empty, could repeat and be non sorted)random
- random number generator
public int getInt(Random r)
Returns a random integer, representing enum ordinal, according to
distribution, if it is possible.
- Specified by:
getInt
in classCustomDistributionAbstract<E extends Enum<?>>
- Parameters:
r
- random number generator- Returns:
- random integer from distribution
public E get(Random r)
Description copied from class:
CustomDistributionAbstract
Returns a random value according to distribution parameters and given random
number generator.
- Specified by:
get
in classCustomDistributionAbstract<E>
- Parameters:
r
- random number generator- Returns:
- random value from distribution