Java Random Int getRandomInt()

Here you can find the source of getRandomInt()

Description

get Random Int

License

Open Source License

Declaration

public static int getRandomInt() 

Method Source Code

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

import java.util.Random;

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

    public static int getRandomInt() {
        return getRandomInt(0, 9);
    }//from w  w  w  .j  a va2  s  . co  m

    public static int getRandomInt(final int a, final int b) {
        return generator.nextInt(b - a + 1) + a;
    }
}

Related

  1. getRandom(int c)
  2. getRandomInt()
  3. getRandomInt()
  4. getRandomInt()
  5. getRandomInt()
  6. getRandomInt()
  7. getRandomInt()
  8. getRandomInt(final int limit)
  9. getRandomInt(final int max)