Java Random randomIntegerList(int sz, int min, int max)

Here you can find the source of randomIntegerList(int sz, int min, int max)

Description

random Integer List

License

Open Source License

Declaration

public static List<Integer> randomIntegerList(int sz, int min, int max) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static List<Integer> randomIntegerList(int sz, int min, int max) {
        List<Integer> lst = new ArrayList<>(sz);
        for (int i = 0; i < sz; i++)
            lst.add(randInt(min, max));//from   www .  jav  a2  s  . c  o  m
        return lst;
    }

    public static int randInt(int min, int max) {
        return min + (int) (Math.random() * ((max - min)));
    }
}

Related

  1. randomId()
  2. randomIndices(Random r, int minCount, int maxCount)
  3. randomInRange(double min, double max)
  4. randomInsults()
  5. randomIntArray(int len, Random rand)
  6. randomIntegers(int sz)
  7. randomIterable(Collection col)
  8. randomKey()
  9. randomKey()