// 数组自由排列
public static void RandomTest() {
Random ran = new Random();
int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int b[] = new int[a.length];
int w = a.length;
int x = 0;
int y;
for (int i = 0; i < a.length; i++) {
y = 0;
x = Math.abs(ran.nextInt()) % w;
// 把随机选中的数,提出来,然后省下数重新排列数组
for (int j = 0; j < w; j++) {
if (x == j) {
b[i] = a[x];
continue;
}
a[y] = a[j];
y++;
}
w--;
System.out.print("~" + b[i] + "~");
}
}