diff --git a/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java b/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java index 30be5725ab..66f82022ea 100644 --- a/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java +++ b/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java @@ -8,12 +8,12 @@ import java.util.function.Supplier; public class RandomInvoker { private final Lazy random = Lazy.of(SplittableRandom::new); - public T withProbability(Supplier supplier1, Supplier supplier2, int probability) { + public T withProbability(Supplier positiveCase, Supplier 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(); } } }