提交 3464b6b6 authored 作者: Sergi Vladykin's avatar Sergi Vladykin

Merge branch 'master' of https://github.com/h2database/h2database into lazyQuery

...@@ -10,7 +10,7 @@ import java.io.DataOutputStream; ...@@ -10,7 +10,7 @@ import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Random; import java.util.concurrent.ThreadLocalRandom;
/** /**
* This is a utility class with mathematical helper functions. * This is a utility class with mathematical helper functions.
...@@ -27,8 +27,6 @@ public class MathUtils { ...@@ -27,8 +27,6 @@ public class MathUtils {
*/ */
static volatile boolean seeded; static volatile boolean seeded;
private static final Random RANDOM = new Random();
private MathUtils() { private MathUtils() {
// utility class // utility class
} }
...@@ -289,7 +287,7 @@ public class MathUtils { ...@@ -289,7 +287,7 @@ public class MathUtils {
* @param bytes the target array * @param bytes the target array
*/ */
public static void randomBytes(byte[] bytes) { public static void randomBytes(byte[] bytes) {
RANDOM.nextBytes(bytes); ThreadLocalRandom.current().nextBytes(bytes);
} }
/** /**
...@@ -318,7 +316,7 @@ public class MathUtils { ...@@ -318,7 +316,7 @@ public class MathUtils {
* @return the random long value * @return the random long value
*/ */
public static int randomInt(int lowerThan) { public static int randomInt(int lowerThan) {
return RANDOM.nextInt(lowerThan); return ThreadLocalRandom.current().nextInt(lowerThan);
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论