Here you can find the source of choice(T... list)
public static <T> T choice(T... list)
//package com.java2s; //License from project: Open Source License import java.util.List; import java.util.Random; import static java.util.Arrays.asList; public class Main { private static final Random RANDOM_SOURCE = new Random(System.currentTimeMillis()); public static <T> T choice(T... list) { return choice(asList(list)); }//from www . j av a2s . c om public static <T> T choice(List<T> list) { return list.get(RANDOM_SOURCE.nextInt(list.size())); } }