Java Random Int getRandomInt(int minimum, int maximum)

Here you can find the source of getRandomInt(int minimum, int maximum)

Description

get Random Int

License

Apache License

Declaration

public static int getRandomInt(int minimum, int maximum) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    public static Random RANDOM = new Random();

    /***********************************************************************/
    public static int getRandomInt(int minimum, int maximum) {
        int diff = maximum - minimum;
        if (diff == 0) {
            return maximum;
        } else {/*from  w w w  . j  ava 2s .  co m*/
            return RANDOM.nextInt(diff) + minimum;
        }
    }
}

Related

  1. getRandomInt(int max)
  2. getRandomInt(int max)
  3. getRandomInt(int min, int max)
  4. getRandomInt(int min, int max)
  5. getRandomInt(int min, int max, Random random)
  6. getRandomInt(int sek, int min, int max)
  7. getRandomInt(int size)
  8. getRandomInt(Random rand, int lower, int upper)
  9. getRandomInt(String level)