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 String RandomNIntforStr(int digits) {
    Random random = new Random();
    StringBuilder sb = new StringBuilder(digits);
    for (int i = 0; i < digits; i++) {
        sb.append(random.nextInt(10));/*from  w  w  w . ja  v a  2 s . com*/
        //         sb.append((char)('0' + rnd.nextInt(10)));  
    }
    return sb.toString();
}

From source file:Main.java

public static int randomColor() {
    Random random = new Random();
    return Color.argb(255, random.nextInt(255), random.nextInt(255), random.nextInt(255));
}

From source file:Main.java

public static int getPicSlNo() {
    int number = -9999;
    Random random = new Random();
    number = random.nextInt(9999);//from w ww.  j  a v a2  s. c om
    return number;
}

From source file:Main.java

public static int randomColor() {
    Random rnd = new Random();
    int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
    return color;
}

From source file:Main.java

public static int gteRandomColor() {
    Random random = new Random();
    return Color.rgb(random.nextInt(200) + 20, random.nextInt(200) + 20, random.nextInt(200) + 20);
}

From source file:Main.java

public static int ParseColor() {
    Random random = new Random();
    int red = random.nextInt(255);
    int green = random.nextInt(255);
    int blue = random.nextInt(255);
    return Color.argb(255, red, green, blue);
}

From source file:Main.java

public static int randomColor() {
    Random __rdn = new Random();
    int __red = __rdn.nextInt(255);
    int __green = __rdn.nextInt(255);
    int __blue = __rdn.nextInt(255);
    return Color.rgb(__red, __green, __blue);
}

From source file:Main.java

public static int randomColor() {
    Random r = new Random();
    int red = r.nextInt(256);
    int green = r.nextInt(256);
    int blue = r.nextInt(256);
    return Color.rgb(red, green, blue);
}

From source file:Main.java

public static String randomNumericString(int stringLength) {
    Random generator = new Random();
    StringBuilder randomStringBuilder = new StringBuilder();
    for (int i = 0; i < stringLength; i++) {
        randomStringBuilder.append(generator.nextInt(9));
    }//from  w  w w.ja va2 s . c  om
    return randomStringBuilder.toString();
}

From source file:Main.java

public static int randomColr() {
    Random random = new Random();
    int r = random.nextInt(180);
    int g = random.nextInt(180);
    int b = random.nextInt(180);
    return Color.rgb(r, g, b);
}