Java Random Int generateRandomInt(int min, int max)

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

Description

generate Random Int

License

Open Source License

Declaration

public static int generateRandomInt(int min, int max) 

Method Source Code


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

import java.util.Random;

public class Main {
    public static int generateRandomInt(int min, int max) {
        Random random = new Random();
        return random.nextInt(max) + min;
    }//from   www  .j  av a 2s .  c o  m
}

Related

  1. generateRandomInt(final int max)
  2. generateRandomInteger(int aStart, int aEnd, Random aRandom)
  3. generateRandomInteger(int start, int end)
  4. generateRandomIntegerArray(int size, int min, int max)
  5. generateRandomIntegers(int numbersNeeded, int bound)