yxh
9 天以前 9df73858bc61e0e268113f5f79a8934e970a4f74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.ruoyi.quartz.util;
 
import java.util.Random;
 
public class RandomStringGenerator {
    //获取随机数
    public static String generateRandomString() {
        String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        StringBuilder sb = new StringBuilder(6);
        Random random = new Random();
        for (int i = 0; i < 6; i++) {
            int index = random.nextInt(str.length());
            sb.append(str.charAt(index));
        }
 
        return sb.toString();
    }
}