Java Random Int getRandomIntegerInRange(Random random, int i, int j)

Here you can find the source of getRandomIntegerInRange(Random random, int i, int j)

Description

get Random Integer In Range

License

Open Source License

Declaration

public static int getRandomIntegerInRange(Random random, int i, int j) 

Method Source Code


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

import java.util.Random;

public class Main {
    public static int getRandomIntegerInRange(Random random, int i, int j) {
        if (i >= j) {
            return i;
        } else {// ww  w.  j av  a  2 s .co  m
            return random.nextInt((j - i) + 1) + i;
        }
    }
}

Related

  1. getRandomIntBetween(int mi, int ma)
  2. getRandomInteger(int aStart, int aEnd)
  3. getRandomInteger(int min, int max)
  4. getRandomIntegerArray(Random rand, int size, int range)
  5. getRandomIntegerInRange(Random p_76136_0_, int p_76136_1_, int p_76136_2_)
  6. getRandomInterests()
  7. getRandomIntFromRange(int min, int max)
  8. getRandomInts(int number)
  9. getRandomIntStr(int len)