### Question:
CollectionUtils { public static <E> Optional<E> getRandom(Collection<E> e) { return e.stream().skip((int) (e.size() * Math.random())).findFirst(); }  static Optional<E> getRandom(Collection<E> e);  }### Answer:
@Test public void testGetRandom() { boolean allValueSame = true; String firstValue = null; for (int i = 0; i < 10; i++) { String radomeValue = i % 2 == 0 ? CollectionUtils.getRandom(stringCollection).get() : new CollectionUtils().getRandom(stringCollection).get(); Assert.assertTrue(stringCollection.contains(radomeValue)); if (firstValue == null) { firstValue = radomeValue; } else if (!radomeValue.equals(firstValue)) { allValueSame = false; } } Assert.assertFalse(allValueSame); }