From d2568577ba0e57828c4a1431f96e55bd9bd0f41b Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Wed, 16 Nov 2022 18:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E5=85=B7=E7=B1=BB?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=95=B0=E9=87=8D=E5=A4=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/dev33/satoken/util/SaFoxUtil.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/util/SaFoxUtil.java b/sa-token-core/src/main/java/cn/dev33/satoken/util/SaFoxUtil.java index 97accc8a..552ed240 100644 --- a/sa-token-core/src/main/java/cn/dev33/satoken/util/SaFoxUtil.java +++ b/sa-token-core/src/main/java/cn/dev33/satoken/util/SaFoxUtil.java @@ -28,10 +28,6 @@ import cn.dev33.satoken.exception.SaTokenException; * */ public class SaFoxUtil { - /** - * 可以减少线程争用的随机对象 - */ - private static final ThreadLocalRandom RANDOM = ThreadLocalRandom.current(); private SaFoxUtil() { } @@ -64,7 +60,7 @@ public class SaFoxUtil { String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { - int number = RANDOM.nextInt(62); + int number = ThreadLocalRandom.current().nextInt(62); sb.append(str.charAt(number)); } return sb.toString(); @@ -113,7 +109,7 @@ public class SaFoxUtil { * @return 随机字符串 */ public static String getMarking28() { - return System.currentTimeMillis() + "" + RANDOM.nextInt(Integer.MAX_VALUE); + return System.currentTimeMillis() + "" + ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE); } /**