cppreference.com > C++ Algorithms > random_sample_n random_sample_n Syntax:
      #include <algorithm>
      iterator random_sample_n( iterator start, iterator end, iterator result, size_t N );
      iterator random_sample_n( iterator start, iterator end, iterator result, size_t N, RandomNumberGenerator& rnd );
The random_sample_n() algorithm randomly copies N elements from [start,end) to result. Elements are chosen with uniform probability and elements from the input range will appear at most once in the output range. Element order is preserved from the input range to the output range. If a random number generator function object rnd is supplied, then it will be used instead of an internal random number generator. The return value of random_sample_n() is an iterator to the end of the output range. random_sample_n() runs in linear time. Related topics: next_permutation prev_permutation random_sample random_shuffle