Here you can find the source of randomElementOf(String[] array)
private static String randomElementOf(String[] array)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static String randomElementOf(String[] array) { int size = array.length; return array[random(size)]; }/* www. java 2s .c o m*/ private static int random(int max) { return new Random().nextInt(max); } }