Java Random Int getRandomIntFromRange(int min, int max)

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

Description

get Random Int From Range

License

Open Source License

Declaration

public static int getRandomIntFromRange(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 final Random random = new Random();

    public static int getRandomIntFromRange(int min, int max) {
        return min + (max > min ? random.nextInt(1 + max - min) : 0);
    }/* ww  w . ja  v a  2s .  c om*/
}

Related

  1. getRandomInteger(int min, int max)
  2. getRandomIntegerArray(Random rand, int size, int range)
  3. getRandomIntegerInRange(Random p_76136_0_, int p_76136_1_, int p_76136_2_)
  4. getRandomIntegerInRange(Random random, int i, int j)
  5. getRandomInterests()
  6. getRandomInts(int number)
  7. getRandomIntStr(int len)
  8. rand(int min, int max)
  9. rand(int size)