Class OptionalRandomizer<T>
java.lang.Object
org.jeasy.random.randomizers.AbstractRandomizer<T>
org.jeasy.random.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 org.jeasy.random.randomizers.AbstractRandomizer
random -
Constructor Summary
ConstructorsConstructorDescriptionOptionalRandomizer(Randomizer<T> delegate, int optionalPercent) Create a newOptionalRandomizerwith a delegate randomizer and an optional percent threshold. -
Method Summary
Methods inherited from class org.jeasy.random.randomizers.AbstractRandomizer
getPredefinedValuesOf, nextDouble, toString
-
Constructor Details
-
OptionalRandomizer
Create a newOptionalRandomizerwith 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:RandomizerGenerate a random value for the given type.- Returns:
- a random value for the given type
-