1.生成20位随机数字
public class test{
public static void main(String[] args) throws InterruptedException {
String str="";
for (int i = 0; i < 20; i++) {
str += String.valueOf((int)(Math.random()*10));
}
System.out.println(str);
}
}
2.随机生成字符串 里面要不是大写 要不是小写
public class test {
public static void main(String[] args) {
String uuid = UUID.randomUUID().
toString().
replace("-", "").
substring(0, 15);
String d = uuid.toUpperCase();//小写转大写
System.out.println(d);
String x = d.toLowerCase();//大写转小写
System.out.println(x);
}
}