Here you can find the source of randomIntegers(int sz)
public static List<Integer> randomIntegers(int sz)
//package com.java2s; /*/* w w w . jav a2 s . c om*/ * Copyright (c) 2014 Tor C Bekkvik * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.util.*; public class Main { public static List<Integer> randomIntegers(int sz) { List<Integer> lst = new ArrayList<>(); Random rand = new Random(); for (int i = 0; i < sz; i++) { lst.add(rand.nextInt(sz * 10)); } return lst; } }