Here you can find the source of randomString(List
public static String randomString(List<String> strings)
//package com.java2s; //License from project: Open Source License import java.util.List; import java.util.concurrent.ThreadLocalRandom; public class Main { public static String randomString(List<String> strings) { return strings.get(ThreadLocalRandom.current().nextInt(strings.size())); }/*from ww w. ja va2 s . c om*/ }