Example usage for java.util Random Random

List of usage examples for java.util Random Random

Introduction

In this page you can find the example usage for java.util Random Random.

Prototype

public Random() 

Source Link

Document

Creates a new random number generator.

Usage

From source file:Main.java

public static int randInt(int min, int max) {
    return new Random().nextInt((max - min) + 1) + min;
}

From source file:Main.java

public static String random5() {
    Random rnd = new Random();

    int num = rnd.nextInt(89999) + 10000;
    return num + "";

}

From source file:Main.java

public static int getRandomColorIndex() {
    Random random = new Random();
    int index = random.nextInt(1000) % 4;
    return index;
}

From source file:Main.java

public static boolean isFlee() {
    Random random = new Random();

    int num = random.nextInt(10);

    return num < 2;
}

From source file:Main.java

public static String getCheckCode() {
    String code = (new Random().nextInt(900000) + 100000) + "";
    return code;
}

From source file:Main.java

public static int getRandomRotate() {
    Random random = new Random();
    return random.nextInt(360);
}

From source file:Main.java

public static char getRandomCharacter() {
    Random r = new Random();
    char c = (char) (r.nextInt(26) + 'a');

    return c;/*from  ww  w .j av a  2  s  .c  o  m*/
}

From source file:Main.java

public static int getNumberByMaxNum(int maxNum) {
    return new Random().nextInt(maxNum);
}

From source file:Main.java

public static int RandomNum(int range) {
    Random random = new Random();
    int i = random.nextInt(range);
    return i;//from w ww.j  ava  2  s . c  om
}

From source file:Main.java

public static int proLevelRandom(int i) {
    Random generator = new Random();
    int result = generator.nextInt(i);
    return result;
}