Java Random Int randInt(int low, int high)

Here you can find the source of randInt(int low, int high)

Description

rand Int

License

Open Source License

Declaration

public static int randInt(int low, int high) 

Method Source Code

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

import java.util.Random;

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

    public static int randInt(int low, int high) {
        if (low > high) {
            throw new IllegalArgumentException();
        }//w w  w . j  a  v a2 s  . co  m
        return rand.nextInt(high - low + 1) + low;
    }

    public static int randInt() {
        return randInt(-4, 4);
    }
}

Related

  1. randBetween(int min, int max)
  2. randInRangeInc(int min, int max)
  3. randInt()
  4. randInt()
  5. randInt(int l)
  6. randint(int max)
  7. randInt(int max)
  8. randInt(int min, int max)
  9. randInt(int min, int max)