This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ac5dcd5  (chores) camel-test-infra-common: use standard lib method for 
generating a bounded random integer (#5826)
ac5dcd5 is described below

commit ac5dcd5708ef6a5e83f789500ee1625c28a6b090
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Mon Jul 12 12:40:42 2021 +0200

    (chores) camel-test-infra-common: use standard lib method for generating a 
bounded random integer (#5826)
---
 .../src/test/java/org/apache/camel/test/infra/common/TestUtils.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestUtils.java
 
b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestUtils.java
index e679285..1a7de4b 100644
--- 
a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestUtils.java
+++ 
b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/TestUtils.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.test.infra.common;
 
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import java.util.function.BooleanSupplier;
 import java.util.function.Predicate;
@@ -98,9 +99,7 @@ public final class TestUtils {
      * @return
      */
     public static int randomWithRange(int min, int max) {
-        int range = (max - min) + 1;
-
-        return (int) (Math.random() * range) + min;
+        return ThreadLocalRandom.current().nextInt(min, max);
     }
 
     /**

Reply via email to