提交 32d4d283 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

SecureRandom is already synchronized

上级 5c6935dd
......@@ -260,10 +260,7 @@ public class MathUtils {
* @return the random long value
*/
public static long secureRandomLong() {
SecureRandom sr = getSecureRandom();
synchronized (sr) {
return sr.nextLong();
}
return getSecureRandom().nextLong();
}
/**
......@@ -286,10 +283,7 @@ public class MathUtils {
len = 1;
}
byte[] buff = new byte[len];
SecureRandom sr = getSecureRandom();
synchronized (sr) {
sr.nextBytes(buff);
}
getSecureRandom().nextBytes(buff);
return buff;
}
......@@ -312,10 +306,7 @@ public class MathUtils {
* @return the random long value
*/
public static int secureRandomInt(int lowerThan) {
SecureRandom sr = getSecureRandom();
synchronized (sr) {
return sr.nextInt(lowerThan);
}
return getSecureRandom().nextInt(lowerThan);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论