List of utility methods to do Random Int Create
int | nextRandInt(int max) next Rand Int GLOBAL_RANDOM.setSeed(System.currentTimeMillis());
return GLOBAL_RANDOM.nextInt(max);
|
int | nextRandInt(int min, int max) next Rand Int return min + nextRandInt(max - min);
|
int | getRandom(int from, int to) get Random return from + (int) (Math.random() * ((to - from) + 1)); |
String | getRandomId() get Random Id StringBuilder sb = new StringBuilder(); for (int i = 0; i < 6; i++) { sb.append(chartable[getRandomIntNum(chartable.length)]); return sb.toString(); |
int | getRandomIntNum(int limit) get Random Int Num return rm.nextInt(limit);
|
int | getRandom(int from, int to) get Random return from + (int) (Math.random() * ((to - from) + 1)); |
int | random(int min, int max) Returns random integer in the range specified. int i1 = random.nextInt(max - min + 1) + min; return i1; |
int | randomInt(int low, int high) Returns a random integer within a specified range. assert low <= high : "low cannot be greater than high"; return _randomSeq.nextInt(high - low + 1) + low; |
BigInteger[] | generateSafePrimes(int size, int certainty, SecureRandom random) generate Safe Primes BigInteger p, q; int qLength = size - 1; for (;;) { q = new BigInteger(qLength, 2, random); p = q.shiftLeft(1).add(ONE); if (p.isProbablePrime(certainty) && (certainty <= 2 || q.isProbablePrime(certainty))) { break; ... |