net.jqwik.engine.properties.arbitraries.randomized.FrequencyGenerator Maven / Gradle / Ivy
The newest version!
package net.jqwik.engine.properties.arbitraries.randomized;
import java.util.*;
import net.jqwik.api.*;
import net.jqwik.engine.properties.shrinking.*;
import net.jqwik.engine.support.*;
import org.jspecify.annotations.*;
class FrequencyGenerator extends ChooseRandomlyByFrequency implements RandomGenerator {
FrequencyGenerator(List extends Tuple.Tuple2> frequencies) {
super(frequencies);
}
@Override
public Shrinkable next(Random random) {
return new ChooseValueShrinkable<>(apply(random), possibleValues());
}
}