List of utility methods to do Random Long
Long | randLong(long minimum, long maximum) rand Long assert minimum <= maximum; long value = Math.abs(seed.nextLong()) % (maximum - minimum + 1) + minimum; assert minimum <= value && value <= maximum; return value; |
long | randLong(long n) rand Long long bits, val; do { bits = (new Random().nextLong() << 1) >>> 1; val = bits % n; } while (bits - val + (n - 1) < 0L); return val; |
long | random(long begin, long end) random long rd = begin + (long) (Math.random() * (end - begin)); if (rd == begin || rd == end) { return random(begin, end); return rd; |
long | random(long max) random return (long) (Math.random() * max); |
long | random(long min, long max) Returns a random long number between the value min and the value max. if (min > max) { throw new ArithmeticException( "min" + String.valueOf(min) + "Value min " + min + " must be lesser than value max " + max); return (long) (Math.random() * (max - min) + min); |
long | random(long range) Returns a random value in the range [1 - range] return (long) ((Math.random() * 100000) % range) + 1; |
String | randomHexOfLong(long max) random Hex Of Long long randomInt = randomLongWithMinMax(0, max); return Long.toHexString(randomInt); |
long | randomLong() random Long x ^= (x << 21);
x ^= (x >>> 35);
x ^= (x << 4);
return Math.abs(x);
|
long | randomLong() random Long return RND.nextLong();
|
long | randomLong(long min, long max) Generates pseudo-random long from specific range. return min + (long) (Math.random() * (max - min)); |