这个多做了一些判断,比如abs,判断i的范围,感觉都是没有必要的。 `while(count < 2){ i = r.nextInt(maxNum); sb.append(str[i]); count ++; }` 这样就好多了。