T
- the type generated by this randomizerpublic class OptionalRandomizer<T> extends AbstractRandomizer<T>
Randomizer
which, according to the optional percent, returns the random value from a delegate.random
Constructor and Description |
---|
OptionalRandomizer(Randomizer<T> delegate,
int optionalPercent)
Create a new
OptionalRandomizer with a delegate randomizer and an optional percent threshold. |
Modifier and Type | Method and Description |
---|---|
static <T> Randomizer<T> |
aNewOptionalRandomizer(Randomizer<T> delegate,
int optionalPercent)
Create a new
OptionalRandomizer . |
T |
getRandomValue()
Generate a random value for the given type.
|
getPredefinedValuesOf, toString
public OptionalRandomizer(Randomizer<T> delegate, int optionalPercent)
OptionalRandomizer
with a delegate randomizer and an optional percent threshold.delegate
- The delegate to use to retrieve a random valueoptionalPercent
- The percent of randomized value to return (between 0 and 100)public static <T> Randomizer<T> aNewOptionalRandomizer(Randomizer<T> delegate, int optionalPercent)
OptionalRandomizer
.T
- the type generated by this randomizerdelegate
- the delegate randomizer to useoptionalPercent
- the optional percent thresholdOptionalRandomizer
public T getRandomValue()
Randomizer
Copyright © 2016. All Rights Reserved.