List of utility methods to do Random Number
String | getRandomNumAndLetterAF(int len) get Random Num And Letter AF String s = ""; s.toCharArray(); return getRandom(len, NUMSLETTER_A_F); |
String | getRandomNumAndStr(int length) get Random Num And Str StringBuffer sbuffer = new StringBuffer(""); Random r = new Random(); for (int i = 0; i < length; i++) { sbuffer.append(ENCODE_TABLE[r.nextInt(62)]); return sbuffer.toString(); |
int | getRandomNumber() get Random Number int randomInt = 0; Random randomGenerator = new Random(); randomInt = randomGenerator.nextInt(CHAR_LIST.length()); if (randomInt - 1 == -1) { return randomInt; } else { return randomInt - 1; |
int | getRandomNumber() get Random Number int[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; Random rand = new Random(); for (int i = 10; i > 1; i--) { int index = rand.nextInt(i); int tmp = array[index]; array[index] = array[i - 1]; array[i - 1] = tmp; int result = 0; for (int i = 0; i < 6; i++) result = result * 10 + array[i]; System.out.println(result); return result; |
int | getRandomNumber() get Random Number Random rand = new Random(); int min = 1; int max = 32768; int num = rand.nextInt(max - min + 1) + min; return num; |
int | getRandomNumber() get Random Number return RANDOM.nextInt(10000);
|
String | getRandomNumber() get Random Number Random random = new Random(); long n = (long) (100000L + random.nextFloat() * 900000L); return new Long(n).toString(); |
int | getRandomNumber(final int from, final int to) Returns a random number between the from and to parameters. return from + (int) Math.floor(random.nextDouble() * ((to + 1) - from)); |
Integer | getRandomNumber(final int maxInt, final int minInt) get Random Number Random rand = new Random(); return rand.nextInt((maxInt - minInt) + 1) + minInt; |
String | getRandomNumber(int bit) get Random Number Random r = new Random(); int randNum = r.nextInt(new Double(Math.pow(10, bit)).intValue()); while (randNum < new Double(Math.pow(10, bit - 1)).intValue()) { randNum = r.nextInt(new Double(Math.pow(10, bit)).intValue()); return String.valueOf(randNum); |