集合打乱顺序从新排序

public static  ArrayList randomList(ArrayList arr){
		Random random = new Random();
		ArrayList rsult = new ArrayList<>();
		while (arr.size()>0) {
			int randIndex = random.nextInt(arr.size());
			rsult.add(arr.remove(randIndex));
		} 
		return rsult;
	}

你可能感兴趣的:(Java)