import java.util.Random;
public class 打乱数组 {
public static void main(String[] args) {
int[] arr={2,588,888,1000,10000};
Random r= new Random();
for (int i = 0; i < arr.length; i++) {
//获取随机索引
int randomIndex=r.nextInt(arr.length);
//将i索引与randomIndex随即索引上的值进行交换
int temp=arr[i];
arr[i]=arr[randomIndex];
arr[randomIndex]=temp;
}
//遍历输出
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]+"元的奖金被抽出");
}
}
}