- java.lang.Object
- com.anylogic.engine.CustomDistributionAbstract<Double>
- com.anylogic.engine.CustomDistributionContinuous
- All Implemented Interfaces:
Serializable
public class CustomDistributionContinuous extends CustomDistributionAbstract<Double> implements Serializable
This class is used to generate random numbers from a probability density
function (PDF) defined as:
- piecewise linear function. Piecewise linear function is defined by values and corresponding weights.
- set of ranges with corresponding weights
- set of samples
Despite that this function defined with discrete number of values, it has continuous nature.
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 |
---|---|
CustomDistributionContinuous |
Constructs a custom empirical distribution from array with occurrences.
|
CustomDistributionContinuous |
Constructs a custom distribution from the given arrays of values and weights.
|
CustomDistributionContinuous |
Constructs a custom distribution from the given arrays of starts, ends and
weights.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. |
CustomDistributionContinuous |
Constructs a custom distribution from the given arrays of starts, ends and
weights.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. |
CustomDistributionContinuous |
Constructs a custom distribution from the given arrays of points and rates.
|
CustomDistributionContinuous |
Constructs a custom empirical distribution from array with occurrences.
|
public CustomDistributionContinuous(double[] values, double[] weights)
Constructs a custom distribution from the given arrays of values and weights.
N
values with weights will be converted into N-1
intervals, which define piecewise linear function for PDF.- Parameters:
values
- the array of values (2 or more, no duplicates)weights
- the array of weights (same size as weights, no negative values)
public CustomDistributionContinuous(double[] values, double[] weights, Random random)
Constructs a custom distribution from the given arrays of points and rates.
N
points with rates will be converted into N-1
intervals, which define piecewise linear function for PDF.- Parameters:
values
- the array of values (2 or more, no duplicates)weights
- the array of weights (same size as values, no negative values)random
- random number generator
public CustomDistributionContinuous(double[] starts, double[] ends, double[] weights, Random random)
Constructs a custom distribution from the given arrays of starts, ends and
weights.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. But the end of the one range could be the beginning of another. For example, ranges [0; 2] and [2; 3] are valid, whereas [0; 2] and [1; 3] are not.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. But the end of the one range could be the beginning of another. For example, ranges [0; 2] and [2; 3] are valid, whereas [0; 2] and [1; 3] are not.
- Parameters:
starts
- the array of ranges starts (1 or more)ends
- the array of ranges ends (same size as starts, each end should be bigger than start)weights
- the array of ranges weights (same size as starts, no negative weights)random
- random number generator
public CustomDistributionContinuous(double[] starts, double[] ends, double[] weights)
Constructs a custom distribution from the given arrays of starts, ends and
weights.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. But the end of the one range could be the beginning of another. For example, ranges [0; 2] and [2; 3] are valid, whereas [0; 2] and [1; 3] are not.
The distribution for the intersect ranges has no sense, thus each range shouldn't intersect with other ranges. But the end of the one range could be the beginning of another. For example, ranges [0; 2] and [2; 3] are valid, whereas [0; 2] and [1; 3] are not.
- Parameters:
starts
- the array of ranges starts (1 or more)ends
- the array of ranges ends (same size as starts, each end should be bigger than start)weights
- the array of ranges weights (same size as starts, no negative weights)
public CustomDistributionContinuous(double[] samples, Random random)
Constructs a custom empirical distribution from array with occurrences.
- Parameters:
samples
- the array of values (non empty, may contain same values and the order of the values does not matter)random
- random number generator
public CustomDistributionContinuous(double[] samples)
Constructs a custom empirical distribution from array with occurrences.
- Parameters:
samples
- the array of values (non empty, may contain same values and the order of the values does not matter)
public Double 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<Double>
- Parameters:
r
- random number generator- Returns:
- random value from distribution
public int getInt(Random r)
Description copied from class:
CustomDistributionAbstract
Returns a random integer according to distribution parameters, if possible.
- Specified by:
getInt
in classCustomDistributionAbstract<Double>
- Parameters:
r
- random number generator- Returns:
- random integer from distribution