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>

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 ([email protected])
  • Constructor Details

    • 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 Details

    • 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