Java Random Int getRandomInt(int min, int max)

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

Description

get Random Int

License

Apache License

Declaration

public static int getRandomInt(int min, int max) 

Method Source Code

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

import java.util.Random;

public class Main {
    public static int getRandomInt(int min, int max) {
        Random rand = new Random();
        int x = rand.nextInt(max - min + 1) + min;
        x = rand.nextInt(max - min + 1) + min;
        return x;
    }//from  w ww  .jav  a  2  s .  c o m
}

Related

  1. getRandomInt(int lower, int upper)
  2. getRandomInt(int lower, int upper)
  3. getRandomInt(int max)
  4. getRandomInt(int max)
  5. getRandomInt(int max)
  6. getRandomInt(int min, int max)
  7. getRandomInt(int min, int max, Random random)
  8. getRandomInt(int minimum, int maximum)
  9. getRandomInt(int sek, int min, int max)