![JAR search and dependency download from the Maven repository](/logo.png)
com.insightfullogic.lambdabehave.impl.generators.ValueSourceGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda-behave Show documentation
Show all versions of lambda-behave Show documentation
A modern testing and behavioural specification framework for Java 8
package com.insightfullogic.lambdabehave.impl.generators;
import com.insightfullogic.lambdabehave.generators.SourceGenerator;
public final class ValueSourceGenerator implements SourceGenerator {
private final int[] values;
private int index;
public ValueSourceGenerator(final int[] values) {
this.values = values;
index = 0;
}
@Override
public int generateInt(final int maxValue) {
try {
final int candidate = values[index];
if (candidate > maxValue)
return candidate & maxValue;
return candidate;
} finally {
index = (index + 1) % values.length;
}
}
/**
* There's no concept of a seed in this case
*
* @return 0
*/
@Override
public long getSeed() {
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy