BAEL-4405 better names for parameters

This commit is contained in:
mdabrowski-eu 2020-08-06 00:11:13 +02:00
parent 18c7b3000e
commit ca8dd7dbc7
1 changed files with 3 additions and 3 deletions

View File

@ -8,12 +8,12 @@ import java.util.function.Supplier;
public class RandomInvoker {
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();
if (random.nextInt(1, 101) <= probability) {
return supplier1.get();
return positiveCase.get();
} else {
return supplier2.get();
return negativeCase.get();
}
}
}