List of utility methods to do Random
float | random() random return random(0f, 1f);
|
float | random() Returns a random positive float, greater than or equal to 0.0 and less than 1.0 . return (float) Math.random(); |
double | random() random return Math.random() * 2 - 1;
|
E | random(E[] elements) random return first(randomList(elements));
|
char | random(final char[] chars) Returns a random character from a sequence of characters. int idx = rand.nextInt(chars.length); return chars[idx]; |
float | random(float min, float max) random final float d = max - min; return min + d * r.nextFloat(); |
float | random(float theStart, float theEnd) random final float myDiff = theEnd - theStart; final float myRandomValue = (float) Math.random() * myDiff; return myRandomValue + theStart; |
int | random(int min, int max) Returns a random number if (max - min == 0) { return min; int rmin = Math.min(max, min); int rmax = Math.max(max, min); return random.nextInt(1 + rmax - rmin) + rmin; |
T | random(List random return list.get(random.nextInt(list.size()));
|
int | random4DigitNumber() random Digit Number return (int) (Math.random() * 9000) + 1000; |