List of usage examples for java.util Random nextInt
public int nextInt(int bound)
From source file:Main.java
public static double nextDouble(int lower, int upper) { Random ra = new Random(); int n = lower + ra.nextInt(upper - lower); double m = ra.nextDouble(); return n + m; }
From source file:Main.java
public static String getRandomChar() { String[] arr = { "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; Random random = new Random(); return arr[random.nextInt(57)]; }
From source file:Main.java
public static int getRandom(int max, int min) { // TODO Auto-generated method stub Random random = new Random(); int getRandom = random.nextInt(max - min + 1) + min; return getRandom; }
From source file:Main.java
public synchronized static Long createId() { int max = 999; int min = 100; Random random = new Random(); Integer s = random.nextInt(max) % (max - min + 1) + min; Long currentTimeMillis = System.currentTimeMillis(); return Long.parseLong(currentTimeMillis.toString() + s.toString()); }
From source file:Main.java
public static float nextFloat(int lower, int upper) { Random ra = new Random(); int n = lower + ra.nextInt(upper - lower); float m = ra.nextFloat(); return n + m; }
From source file:Main.java
public static int getRandomColor() { Random rnd = new Random(); return Color.argb(50, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); }
From source file:Main.java
public static <T> T random(T[] array, Random random) { return array[random.nextInt(array.length)]; }
From source file:Main.java
public static int getRandomColor() { Random random = new Random(); int alpha = random.nextInt(50) + 206; int red = random.nextInt(200); int green = random.nextInt(200); int blue = random.nextInt(200); return Color.argb(alpha, red, green, blue); }
From source file:Main.java
public static int getRandomColor() { Random random = new Random(); int red = random.nextInt(200) + 30; int gre = random.nextInt(200) + 30; int blu = random.nextInt(200) + 30; return Color.rgb(red, gre, blu); }
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)); }