import java.security.SecureRandom;
import java.util.Random;
/*
* 16位随机码分割
* 格式:
* XXXX-XXXX-XXXX-XXXX-XXXX
*
*/
public class CutApartNumber {
public static void main(String[] args) {
String uid = addblankinmiddle(getGUID());
System.out.println(uid);
}
// 生成20位不重复的随机数,含数字+大写
public static String getGUID() {
StringBuilder uid = new StringBuilder();
// 产生20位强随机数
Random random = new SecureRandom();
for (int i = 0; i < 20; i++) {
// 产生0-1的的2位随机数
int type = random.nextInt(2);
switch (type) {
case 0:
// 0-9的随机数
uid.append(random.nextInt(10));
break;