### Question:
RandomUtil { public static <K, V> Map.Entry<K, V> randomEntry(Map<K, V> map) { if (map == null || map.size() == 0) { return null; } int index = randomInt(0, map.size()); int counter = 0; Map.Entry<K, V> ret = null; for (Map.Entry<K, V> entry : map.entrySet()) { if (counter == index) { ret = entry; } counter++; } return ret; }  static void setDefaultRandom(Random rand); static double pseudoRandomFromString(String str); static int randomInt(int fromInclusive, int toExclusive); static int randomInt(int fromInclusive, int toExclusive, Random rand); static T randomMember(Collection<T> col); static int sampleFromCDF(double[] cdf, double p); static int sampleFromCDF(double[] cdf, Random rand); static int sampleFromWeighted(double[] weights, double zero2one); static T randomMember(Collection<T> col, Random rand); static T removeRandom(Collection<T> col); static Map.Entry<K, V> randomEntry(Map<K, V> map); static T randomFromIterator(Iterator<T> iter); static T randomFromIterator(Iterator<T> iter, Random rand); static T removeRandomFast(ArrayList<T> list, Random rand); static ArrayList<T> getSample(Iterable<T> from, int size); static String randomAlphaNumericString(int length, Random rand); static ArrayList<T> getSample(Iterable<T> from, int size, Random rand); static void shuffleIntArray(int[] s, Random rand); static int[] toShuffledIntArray(Collection<Integer> c, Random rand); static void main(String[] args);  }### Answer:
@Test public void testRandomEntry() { Map<Integer, Integer> integers = new HashMap<Integer, Integer>(); for (int i = 0; i < 10000; i++) { integers.put(i,i); } for (int i = 0; i < 10000; i++) { assertTrue(integers.containsKey(RandomUtil.randomEntry(integers).getKey())); } }