[#absl-c_sample] = xref:absl.adoc[absl]::c_sample :relfileprefix: ../ :mrdocs: Container‐based version of the <algorithm> `std::sample()` function to randomly sample elements from the container without replacement using a `gen()` uniform random number generator and write them to an iterator range. == Synopsis Declared in `<absl/algorithm/container.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename C, typename OutputIterator, typename Distance, typename UniformRandomBitGenerator> OutputIterator c_sample( C const& c, OutputIterator result, Distance n, UniformRandomBitGenerator&& gen); ---- == Return Value An iterator to the end of the written range in the output. == Parameters [cols="1,4"] |=== | Name| Description | *c* | The container to sample from. | *result* | The output iterator receiving the sampled elements. | *n* | The number of elements to sample. | *gen* | The uniform random bit generator driving the sampling. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#