code: public static <T> T randomElementOf(final List<T> list) {
          if (list.isEmpty()) {
              return null;
          }
          return list.get(nextInt(0, list.size()));
      }
docs: Get a random element from the list.
  
  @param list the input list
  @param <T>  the type of elements in the list
  @return a random element from the list or null if the list is empty