关于随机字符串的生成
这里只有随机生成十位长度为1-10的字符串,打印输出没写
Random random = new Random();
List<String> list = new ArrayList<String>();
String string = "0123456789qwertyuioplkjhgfdsazxcvbnm0123456789QWERTYUIOPLKJHGFDASZXCVBNM";
for (int i = 0; i < 10; i++) {
int length = (int) (Math.random() * 10 + 1);
StringBuilder sb = new StringBuilder();
for (int j = 0; j < length; j++) {
do {
char str = string.charAt(random.nextInt(string.length()));
sb.append(str);
} while (list.contains(sb));
}
list.add(sb.toString());
}