List of usage examples for java.util Random nextInt
public int nextInt(int bound)
From source file:Main.java
public static int getRandomRoll(int min, int max) { Random random = new Random(); return random.nextInt((max - min) + 1) + min; }
From source file:Main.java
/** * get random number from your boundary/* w w w . j a v a 2 s.c o m*/ * * @param number max number till you want get random. * @return random number */ public static int getRandom(int number) { Random rand = new Random(); return rand.nextInt(number); }
From source file:Main.java
public static String getRandomTAG(List<String> list) { Random random = new Random(); int i = random.nextInt(list.size()); return list.get(i); }
From source file:Main.java
public static int getPicSlNo() { int number = -9999; Random random = new Random(); number = random.nextInt(9999); return number; }
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 genNum() { int max = 200; int min = 100; Random random = new Random(); int s = random.nextInt(max) % (max - min + 1) + min; return s + ""; }
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 String random5() { Random rnd = new Random(); int num = rnd.nextInt(89999) + 10000; return num + ""; }
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); }
From source file:Main.java
public static String RandomStrFromArray(String[] array) { Random random = new Random(); int index = random.nextInt(array.length); return array[index]; }