Here you can find the source of randomValue(T[] array)
public static <T> T randomValue(T[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static <T> T randomValue(T[] array) { int index = (int) (Math.random() * array.length); return array[index]; }/*from ww w .ja v a2s .co m*/ }