[#absl-c_sample]
= xref:absl.adoc[absl]::c&lowbar;sample
:relfileprefix: ../
:mrdocs:

Container&hyphen;based version of the &lt;algorithm&gt; `std&colon;&colon;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&period;

== Synopsis

Declared in `&lt;absl&sol;algorithm&sol;container&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename C,
    typename OutputIterator,
    typename Distance,
    typename UniformRandomBitGenerator&gt;
OutputIterator
c&lowbar;sample(
    C const& c,
    OutputIterator result,
    Distance n,
    UniformRandomBitGenerator&& gen);
----

== Return Value

An iterator to the end of the written range in the output&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *c*
| The container to sample from&period;
| *result*
| The output iterator receiving the sampled elements&period;
| *n*
| The number of elements to sample&period;
| *gen*
| The uniform random bit generator driving the sampling&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
