Android Random Int Create random(int min, int max)

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

Description

Returns random integer in the range specified.

Parameter

Parameter Description
min value allowed for random integer
max value allowed for the random integer

Return

random integer

Declaration

public static int random(int min, int max) 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    private static Random random = new Random();

    /**/* w  w w  . j a va 2  s. co  m*/
     * Returns random integer in the range specified.
     * 
     * @param min
     *            value allowed for random integer
     * @param max
     *            value allowed for the random integer
     * @return random integer
     */
    public static int random(int min, int max) {

        int i1 = random.nextInt(max - min + 1) + min;
        return i1;
    }
}

Related

  1. nextRandInt(int min, int max)
  2. getRandom(int from, int to)
  3. getRandomId()
  4. getRandomIntNum(int limit)
  5. getRandom(int from, int to)
  6. randomInt(int low, int high)
  7. generateSafePrimes(int size, int certainty, SecureRandom random)