String[] beforeShuffle = new String[] {"1", "2", "3", "4", "5", "6", "7",
"8", "9","10"
};
List list = Arrays.asList(beforeShuffle);
Collections.shuffle(list);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
sb.append(list.get(i));
}
String afterShuffle = sb.toString();
String bianhao = afterShuffle.substring(3, 9);
比较简单,用着方便
时间: 2024-10-12 19:27:44