加盟商编码

This commit is contained in:
苏竹红
2024-06-19 09:53:15 +08:00
parent cc11f58a56
commit 998909c522
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package com.cool.store.utils;
import java.util.Random;
/**
* @Author suzhuhong
* @Date 2024/6/19 9:51
* @Version 1.0
*/
public class RandomEightCharCodeUtils {
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
public static String getCode() {
Random random = new Random();
StringBuilder randomCode = new StringBuilder(8);
for (int i = 0; i < 8; i++) {
int index = random.nextInt(CHARACTERS.length());
randomCode.append(CHARACTERS.charAt(index));
}
return randomCode.toString();
}
}