加盟商编码
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user