Java Random randomIntegers(int sz)

Here you can find the source of randomIntegers(int sz)

Description

random Integers

License

Mozilla Public License

Declaration

public static List<Integer> randomIntegers(int sz) 

Method Source Code


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

Related

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