Java Utililty Methods Random Int

List of utility methods to do Random Int

Description

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

Method

intgenerateRandomIntValue()
generate Random Int Value
int randomID = (int) generateRandomLongValue(MIN_SEED, Integer.MAX_VALUE);
return randomID;
intgenerateRandomNoInRange(int max, int min)
Generates a random number in the provided range.
return min + (int) Math.random() * ((max - min) + 1);
intgenerateRandomSeed(int min, int max)
Generate min ~ max random number
if (min == max) {
    return min;
double seed = Math.random() * (max - min) + min;
return (int) Math.round(seed);
StringgenerateRandomTargetId(final String uniqueId, final int count)
Generates a random target it in the form of T0.
return generateRandomTargetId(uniqueId) + count;
intgetIntRandom(int i)
get Int Random
java.util.Random r = new java.util.Random(System.currentTimeMillis());
return r.nextInt(i);
intgetIntRandomReqId()
Method to get integer random id.
Random random = new Random();
int n = random.nextInt();
if (n < 0) {
    n = -n;
return n;
intgetIntRandomValue(int paramInt)
get Int Random Value
if (paramInt == 0) {
    return paramInt;
return new Random().nextInt(paramInt);
intgetPositiveInt()
get Positive Int
int r = random.nextInt();
if (r < 0) {
    r = -r;
return r;
StringgetRandom(int c)
get Random
Random r = new Random();
SimpleDateFormat format = new SimpleDateFormat("ssSSS");
Date d = new Date();
StringBuffer sb = new StringBuffer();
sb.append(format.format(d));
sb.append(r.nextInt(10));
return sb.toString();
intgetRandomInt()
Generates a new random integer
return random.nextInt();