Java tutorial
import java.util.Arrays; import java.util.List; import java.util.Random; public class Main { public static void main(String[] args) { String[] peoples = { "A", "B", "C", "D", "E", "F" }; List<String> names = Arrays.asList(peoples); for (int i = 0; i < peoples.length; i++) { int index = new Random().nextInt(names.size()); String anynames = names.get(index); System.out.println(anynames); } } }