public void shuffle(int[] A) {
if (A == null || A.length == 0) return;
for (int i = 0; i < A.length-1; ++i) {
int random = Math.random()*(A.length-i) + i;
int temp = A[i];
A[i] = A[random];
A[random] = temp;
}
}
转载于:https://www.cnblogs.com/jxlgetter/p/4395074.html