BAEL-4405 better names for parameters
This commit is contained in:
parent
18c7b3000e
commit
ca8dd7dbc7
@ -8,12 +8,12 @@ import java.util.function.Supplier;
|
|||||||
public class RandomInvoker {
|
public class RandomInvoker {
|
||||||
private final Lazy<SplittableRandom> random = Lazy.of(SplittableRandom::new);
|
private final Lazy<SplittableRandom> random = Lazy.of(SplittableRandom::new);
|
||||||
|
|
||||||
public <T> T withProbability(Supplier<T> supplier1, Supplier<T> supplier2, int probability) {
|
public <T> T withProbability(Supplier<T> positiveCase, Supplier<T> negativeCase, int probability) {
|
||||||
SplittableRandom random = this.random.get();
|
SplittableRandom random = this.random.get();
|
||||||
if (random.nextInt(1, 101) <= probability) {
|
if (random.nextInt(1, 101) <= probability) {
|
||||||
return supplier1.get();
|
return positiveCase.get();
|
||||||
} else {
|
} else {
|
||||||
return supplier2.get();
|
return negativeCase.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user