Java – How to shuffle an ArrayList
In Java, you can use Collections.shuffle to shuffle or randomize a ArrayList TestApp.java package com.mkyong.utils; import java.util.Arrays; import java.util.Collections; import java.util.List; public class TestApp { public static void main(String[] args) { List<String> list = Arrays.asList("A", "B", "C", "D", "1", "2", "3"); //before shuffle System.out.println(list); // again, same insert order System.out.println(list); // shuffle or randomize Collections.shuffle(list); …