public static void main(String[] args) {
//length = 6 生成的位数
int length = 6;标签:Java,拼音,int,Demo,length,StringBuffer,sb,ALLCHAR From: https://www.cnblogs.com/yangjieboke/p/17744803.html
StringBuffer sb = new StringBuffer();
String ALLCHAR = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
Random random = new Random();
for (int i = 0; i < length; i++) {
sb.append(ALLCHAR.charAt(random.nextInt(ALLCHAR.length())));
}
System.out.println(sb.toString());
}