Java Random getRandomServices(int maxSize)

Here you can find the source of getRandomServices(int maxSize)

Description

get Random Services

License

Apache License

Declaration

public static String[] getRandomServices(int maxSize) 

Method Source Code

//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;
    }
}

Related

  1. getRandomFloat()
  2. getRandomFloatArray()
  3. getRandomObject()
  4. getRandomPort(int low, int high)
  5. getRandomRequestId(Integer serviceId)
  6. getRandomUUID()
  7. isRandomList(List list)
  8. medianHelper(List list, int k, Random r)
  9. multSample(Random rng, double[] vals, double normsum)