### Question:
Randoms { public static int randomInt(final int max) { if (max == 0) { return 0; } return newRandom().nextInt(max); }  static String randomString(final int length); static char randomChar(); static String randomString(); static String randomEmailAddress(); static String randomPhoneNumber(); static DateTime randomDateTime(); static LocalDateTime randomLocalDateTime(); static LocalDate randomLocalDate(); static LocalTime randomLocalTime(); static E randomEnum(final Class<E> enumClass); static Set<E> randomEnumSet(final Class<E> enumClass); static E randomEnumInSet(final Set<E> enumSet); static Set<T> randomSubset(final Set<T> set); static int randomInt(final int max); static float randomFloat(); static double randomDouble(); static long randomLong(); static boolean randomBoolean(); static BigDecimal randomBigDecimal(final int maxValue, final int precision); static BigDecimal randomPositiveBigDecimal(final int maxValue, final int precision); static int randomIntInRange(final int from, final int to); static String randomCreditCardNumber(final String prefix); static String randomId(); static T randomItem(final T[] array); static T randomItem(final Collection<T> collection); static Set<String> randomIdSet();  }### Answer:
@Test public void shouldReturnRandomIntInRange_givenMax() { final Set<Integer> randomInts = new HashSet<>(); for (int n = 0; n < 100; n++) { final int randomInt = Randoms.randomInt(Integer.MAX_VALUE); assertTrue(randomInt >= 0 && randomInt < Integer.MAX_VALUE); randomInts.add(randomInt); } assertTrue("100 random samples should not all be same int: " + randomInts.iterator().next(), randomInts.size() > 1); }
@Test public void shouldReturnZero_givenRandomIntMaxZero() { final int max = 0; final int result = Randoms.randomInt(max); assertThat(result, is(0)); }