随机数代码优化

master
星期八 3 years ago
parent bc512abc0b
commit 61d69e4b5f
  1. 6
      panda-code/src/main/java/org/panda/code/uitl/StringUtil.java

@ -71,11 +71,11 @@ public class StringUtil {
public static String randomString(int length){
StringBuffer randomString=new StringBuffer();
while (length>0){
Random random=new Random();
int ran=random.nextInt(3);
ThreadLocalRandom threadLocalRandom = ThreadLocalRandom.current();
int ran=threadLocalRandom.nextInt(3);
switch (ran){
case 0:
randomString.append(random.nextInt(10));
randomString.append(threadLocalRandom.nextInt(10));
break;
case 1:
randomString.append(randomLowerCase());

Loading…
Cancel
Save