Here you can find the source of getRandomServices(int maxSize)
public static String[] getRandomServices(int maxSize)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { private static String[] services; public static String[] getRandomServices(int maxSize) { Random r = new Random(); Integer size = r.nextInt(maxSize) + 1; String[] res = new String[size]; //res index int in = 0; Integer caller_size = services.length; for (int i = 0; i < size; i++) { Integer index = r.nextInt(caller_size); res[in] = services[index];/* ww w . j a v a 2 s .c om*/ in++; } return res; } }