Class OptionalRandomizer<T>
java.lang.Object
io.github.krandom.randomizers.AbstractRandomizer<T>
io.github.krandom.randomizers.misc.OptionalRandomizer<T>
- Type Parameters:
T
- the type generated by this randomizer
- All Implemented Interfaces:
Randomizer<T>
A
Randomizer
which, according to the optional percent, returns the random value from a
delegate.- Author:
- Eric Taix ([email protected])
-
Field Summary
Fields inherited from class io.github.krandom.randomizers.AbstractRandomizer
random
-
Constructor Summary
ConstructorsConstructorDescriptionOptionalRandomizer
(Randomizer<T> delegate, int optionalPercent) Create a newOptionalRandomizer
with a delegate randomizer and an optional percent threshold. -
Method Summary
Methods inherited from class io.github.krandom.randomizers.AbstractRandomizer
getPredefinedValuesOf, nextDouble, toString
-
Constructor Details
-
OptionalRandomizer
Create a newOptionalRandomizer
with a delegate randomizer and an optional percent threshold.- Parameters:
delegate
- The delegate to use to retrieve a random valueoptionalPercent
- The percent of randomized value to return (between 0 and 100)
-
-
Method Details
-
getRandomValue
Description copied from interface:Randomizer
Generate a random value for the given type.- Returns:
- a random value for the given type
-