Java Random Int generateRandomInts(int range, int noOfElements)

Here you can find the source of generateRandomInts(int range, int noOfElements)

Description

generate Random Ints

License

Apache License

Declaration

public static int[] generateRandomInts(int range, int noOfElements) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    public static int[] generateRandomInts(int range, int noOfElements) {
        Random randomGenerator = new Random();
        int generatedInts[] = new int[noOfElements];
        for (int i = 0; i < generatedInts.length; i++) {
            generatedInts[i] = randomGenerator.nextInt(range);
        }/*from w  ww  .  j a v a 2  s  .c  o m*/
        return generatedInts;
    }
}

Related

  1. generateRandomInteger(int start, int end)
  2. generateRandomIntegerArray(int size, int min, int max)
  3. generateRandomIntegers(int numbersNeeded, int bound)
  4. generateRandomIntInRange(int min, int max)
  5. generateRandomIntObj(int range, int noOfElements)
  6. generateRandomIntUpto(int max)
  7. generateRandomIntValue()
  8. generateRandomNoInRange(int max, int min)
  9. generateRandomSeed(int min, int max)