java.lang.Object
io.jenetics.stat.Samplers
This class defines some default samplers.
- Since:
- 8.0
- Version:
- 8.3
-
Method Summary
Modifier and TypeMethodDescriptionstatic Sampler
gaussian
(double mean, double stddev) Return a Gaussian sampler with the given parameter.static Sampler
gaussian
(double mean, double stddev, int maxRetries) Return a Gaussian sampler with the given parameter.static Sampler
linear
(double mean) Return a new sampler for a linear distribution with the givenmean
value, when creating sample points for the normalized range[0, 1)
.static Sampler
triangular
(double c) Return a new sampler for a normalized triangle distribution with the points[0, c, 1]
.static Sampler
triangular
(double a, double c, double b) Create a new sampler for a triangle distribution with the given parameters.
-
Method Details
-
linear
Return a new sampler for a linear distribution with the givenmean
value, when creating sample points for the normalized range[0, 1)
.- Parameters:
mean
- the mean value of the sampler distribution- Returns:
- a new linear sampler with the given
mean
value - Throws:
IllegalArgumentException
- if the givenmean
value is not within the range[0, 1)
-
triangular
Create a new sampler for a triangle distribution with the given parameters. All parameters must be within the normalized range[0, 1]
. The sample value, returned by theSampler.sample(RandomGenerator, DoubleRange)
method, is then stretched to the desired range.- Parameters:
a
- the normalized start point of the trianglec
- the normalized middle point of the triangleb
- the normalized end point of the triangle- Returns:
- a new triangle distribution sampler
- Throws:
IllegalArgumentException
- if one of the parameters is not within the range[0, 1]
orb <= a || c > b || c < a
- See Also:
-
triangular
Return a new sampler for a normalized triangle distribution with the points[0, c, 1]
.- Parameters:
c
- the middle point of the triangle within the range[0, 1]
- Returns:
- a new triangle distribution sampler
- Throws:
IllegalArgumentException
- if c not within[0, 1]
- See Also:
-
gaussian
Return a Gaussian sampler with the given parameter. The sampler returnsDouble.NaN
if it is not possible to create a normal distributed value within the desired range.- Parameters:
mean
- the mean value of the Gaussian samplerstddev
- the standard deviation of the Gaussian samplermaxRetries
- the maximal number of retries, if a generated value is not in the desired range.- Returns:
- a Gaussian sampler
- Throws:
IllegalArgumentException
- ifmaxRetries
is smaller than one- Since:
- 8.3
-
gaussian
Return a Gaussian sampler with the given parameter. The sampler returnsDouble.NaN
if it is not possible to create a normal distributed value within the desired range after 25 tries.- Parameters:
mean
- the mean value of the Gaussian samplerstddev
- the standard deviation of the Gaussian sampler- Returns:
- a Gaussian sampler
- Throws:
IllegalArgumentException
- ifmaxRetries
is smaller than one- Since:
- 8.3
-