Unverified 提交 1f64833c authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #714 from katzyn/MathUtils

SecureRandom is already synchronized
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论