code: public static <T extends Entity> Optional<T> randomEntityOfType(final EntityContainer container,
  	    final Class<T> type) {
  	final Set<T> entities = container.getEntitiesOfType(type);
  	final int size = entities.size();
  	return randomEntity0(entities.stream(), size);
      }
docs: Gets a random entity from the container of the given type (if there is one).
  
  @param container
  Source container.
  @param type
  Entity type.
  @return Random entity (if found).