Java tutorial
//package com.java2s; public class Main { /** * Pick a random index from a list of items * @param items - the collection of data * @return a index value between 0 and n-1 */ @SafeVarargs public static <T> int randomIndex(T... items) { int picked = (int) (Math.random() * items.length); return picked; } }