```
template<class PopulationIterator, class SampleIterator,
class Distance, class UniformRandomBitGenerator>
SampleIterator sample(PopulationIterator first, PopulationIterator last,
SampleIterator out, Distance n,
UniformRandomBitGenerator&& g);
```

Requires:

- SampleIterator shall satisfy the additional requirements of a random access iterator unless PopulationIterator satisfies the additional requirements of a forward iterator.
- Distance shall be an integer type.
- remove_reference_t<UniformRandomBitGenerator> shall satisfy the requirements of a uniform random bit generator type ([rand.req.urng]) whose return type is convertible to Distance.

Effects:
Copies min(last - first, n) elements (the *sample*)
from [first, last) (the *population*) to out
such that each possible sample has equal probability of appearance.