本帖最后由 cat73 于 2016-8-9 21:11 编辑
[Java] 纯文本查看 复制代码 final int[] array = new int[10];
for (int index = 0, num = 1; index < 10 && num <= 10; index++, num++) {
array[index] = num;
}
final Random rand = new Random();
for (int i = array.length; i > 1; i--) {
ArrayUtil.swap(array, i - 1, rand.nextInt(i));
}
|