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

Stringrandom(int length, String data)
random
String str = "";
int len = data.length();
while (length > 0) {
    length--;
    str += data.charAt((int) (Math.random() * len));
return str;
intrandom(int limit)
random
return ((limit < 1) ? -1 : (int) ((Math.random() * 100000) % (limit)) + 1);
intrandom(int lo, int hi)
Answer a (pseudo-)random integer lo <= x < hi Creation date: (08.10.2002 20:34:42)
int len = hi - lo;
int x = (int) (Math.random() * len);
return lo + x;
intRandom(int low, int high)
Random
return low + (int) (((double) high - (double) low) * Math.random());
intrandom(int lowerBound, int upperBound)
random
return (lowerBound + (int) Math.round(Math.random() * (upperBound - lowerBound)));
intrandom(int maxValue)
random
return (int) (Math.random() * (maxValue + 1));
intrandom(int min, int max)
random
return (int) (Math.random() * max + min);
intrandom(int min, int max)
random
return (int) Math.round(random((double) min, max));
intrandom(int min, int max)
random
return (int) (min + (Math.random() * max));
intrandom(int min, int max)
random
return (int) (min + Math.random() * (max - min));