Class OptionalRandomizer
-
- All Implemented Interfaces:
-
io.github.krandom.api.Randomizer
public class OptionalRandomizer<T> extends AbstractRandomizer<T>
A Randomizer which, according to the optional percent, returns the random value from a delegate.
Eric Taix ([email protected])
-
-
Constructor Summary
Constructors Constructor Description OptionalRandomizer(Randomizer<T> delegate, int optionalPercent)
Create a new OptionalRandomizer with a delegate randomizer and an optional percent threshold.
-
Method Summary
Modifier and Type Method Description T
getRandomValue()
Generate a random value for the given type. -
-
Constructor Detail
-
OptionalRandomizer
OptionalRandomizer(Randomizer<T> delegate, int optionalPercent)
Create a new OptionalRandomizer 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 Detail
-
getRandomValue
T getRandomValue()
Generate a random value for the given type.
- Returns:
a random value for the given type
-
-
-
-