NumberUtil { public static long getRandomLong(long bound) { long b, l; do { b = (RANDOM.nextLong() << 1) >>> 1; l = b % bound; } while (b - l + (bound - 1) < 0L); return l; }  static int limitInt(int value, int min, int max); static long limitLong(long value, long min, long max); static int getRandomInt(int min, int max); static long getRandomLong(long bound); static float getRandomFloat(float bound, int scale); static float getRandomFloat(float bound, int scale, int roundingMode); static double getRandomDouble(double bound, int scale); static double getRandomDouble(double bound, int scale, int roundingMode); static double getDouble(double d, int scale); static double getDouble(double d, int scale, int roundingMode);  }
@Test public void testGetRandomLong() { long bound = 1234567890L; assertTrue(NumberUtil.getRandomLong(bound) < bound); }