慕斯卡3555197
2019-07-25 23:14
String st = "abcdefghijklmnopqrstuvwxyzABCDEF" + "GHIJKLMNOPORSTUVWXYZ1234567890"; List<String> test = new ArrayList<String>(); for(int n=0;n<10;n++) { Random ran = new Random(); int s=ran.nextInt(9)+1; StringBuilder test1 = new StringBuilder(); for(int i=0;i<s;i++) { Random random = new Random(); do { int num = random.nextInt(st.length()); test1.append(st.charAt(num)); }while(test.contains(test1.toString())); } test.add(test1.toString()); System.out.println("将要添加字符:"+test1.toString());
还没有人回答问题,可以看看其他问题
Java入门第三季
409787 学习 · 4340 问题
相似问题