import java.util.Arrays;
import java.util.Random;
public class HomeWork03 {
public static void main(String[] args){
int[] arr ={1,5,4,23,65,25,8,10,20,45};
System.out.println("置换前:"+Arrays.toString(arr));
for (int i = arr.length-1; i >0; i--) {
int index = new Random().nextInt(i);
int temp=arr[i];
arr[i]=arr[index];
arr[index]=temp;
}
System.out.println("高纳德置乱算法:"+Arrays.toString(arr));
}
}
原文:https://www.cnblogs.com/C33baby/p/12781372.html