Class OptionalRandomizer<T>

  • Type Parameters:
    T - the type generated by this randomizer
    All Implemented Interfaces:
    Randomizer<T>

    public class OptionalRandomizer<T>
    extends AbstractRandomizer<T>
    A Randomizer which, according to the optional percent, returns the random value from a delegate.
    Author:
    Eric Taix (eric.taix@gmail.com)
    • Constructor Detail

      • OptionalRandomizer

        public 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 value
        optionalPercent - The percent of randomized value to return (between 0 and 100)
    • Method Detail

      • getRandomValue

        public T getRandomValue()
        Description copied from interface: Randomizer
        Generate a random value for the given type.
        Returns:
        a random value for the given type