public <T> List<T> randomElements(List<T> elements, int count) {
		if (elements.size() >= count) {
			return extractRandomList(elements, count);
		} else {
			List<T> randomElements = new ArrayList<T>();
			randomElements.addAll(extractRandomList(elements, count % elements.size()));
			do {
				randomElements.addAll(extractRandomList(elements, elements.size()));
			} while (randomElements.size() < count);
			return randomElements;
		}
	}
public < T > List < T > randomElements ( List < T > elements , int count ) { if ( elements . size ( ) >= count ) { return extractRandomList ( elements , count ) ; } else { List < T > randomElements = new ArrayList < T > ( ) ; randomElements . addAll ( extractRandomList ( elements , count % elements . size ( ) ) ) ; do { randomElements . addAll ( extractRandomList ( elements , elements . size ( ) ) ) ; } while ( randomElements . size ( ) < count ) ; return randomElements ; } }
Creates new list being random subset of the passed list

@param <T>      element generic type
@param elements list to process
@param count    returned list size
@return sublist of the elements list