Class NormalIntegerGenerator.Builder
- Enclosing class:
NormalIntegerGenerator
Builds a
NormalIntegerGenerator, defaulting to a standard normal distribution (mean 0, standard deviation 1) spanning the full int range.- Since:
- 2.11.0
-
Field Summary
Fields inherited from class AbstractBuilder
DEFAULT_REFERENCE, random -
Constructor Summary
ConstructorsConstructorDescriptionBuilder(RandomGenerator random) Creates a builder drawing from the given random source. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a configured data generator.max(int max) Sets the inclusive upper bound that rounded values are clamped to.mean(double mean) Sets the distribution mean (center); kept as adoubleso the center may sit between integers.min(int min) Sets the inclusive lower bound that rounded values are clamped to.standardDeviation(double standardDeviation) Sets the distribution standard deviation (spread); must be non-negative.
-
Constructor Details
-
Builder
Creates a builder drawing from the given random source.- Parameters:
random- the random source backing the generated values
-
-
Method Details
-
mean
Sets the distribution mean (center); kept as adoubleso the center may sit between integers. Returns this builder for chaining.- Parameters:
mean- the mean of the normal distribution- Returns:
- this builder
-
standardDeviation
Sets the distribution standard deviation (spread); must be non-negative. Returns this builder for chaining.- Parameters:
standardDeviation- the standard deviation of the normal distribution- Returns:
- this builder
-
min
Sets the inclusive lower bound that rounded values are clamped to. Returns this builder for chaining.- Parameters:
min- the minimum value- Returns:
- this builder
-
max
Sets the inclusive upper bound that rounded values are clamped to. Returns this builder for chaining.- Parameters:
max- the maximum value- Returns:
- this builder
-
build
Description copied from interface:BuilderBuilds and returns a configured data generator.- Returns:
- a new
DataGeneratorconfigured with the builder's settings
-