Android Utililty Methods Random Int Create

List of utility methods to do Random Int Create

Description

The list of methods to do Random Int Create are organized into topic(s).

Method

intnextRandInt(int max)
next Rand Int
GLOBAL_RANDOM.setSeed(System.currentTimeMillis());
return GLOBAL_RANDOM.nextInt(max);
intnextRandInt(int min, int max)
next Rand Int
return min + nextRandInt(max - min);
intgetRandom(int from, int to)
get Random
return from + (int) (Math.random() * ((to - from) + 1));
StringgetRandomId()
get Random Id
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 6; i++) {
    sb.append(chartable[getRandomIntNum(chartable.length)]);
return sb.toString();
intgetRandomIntNum(int limit)
get Random Int Num
return rm.nextInt(limit);
intgetRandom(int from, int to)
get Random
return from + (int) (Math.random() * ((to - from) + 1));
intrandom(int min, int max)
Returns random integer in the range specified.
int i1 = random.nextInt(max - min + 1) + min;
return i1;
intrandomInt(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;
...