reservoirSamplingCommand

Invokes the appropriate reservoir sampling routine based on the command line arguments.

This routine selects the appropriate reservoir sampling function and template instantiation to use based on the command line arguments.

Reservoir sampling is used when a fixed size sample is being selected from an input stream. Weighted and unweighted sampling is supported. These routines also randomize the order of the selected lines. This is consistent with line order randomization of the entire input stream (handled by randomizeLinesCommand).

For unweighted sampling there is a performance tradeoff between the two available implementations. Heap-based sampling is faster for small sample sizes, Algorithm R is faster for large sample sizes. The threshold used here was chosen based on performance tests. See the reservoirSamplingAlgorithmR documentation for more information.

void
reservoirSamplingCommand
(
OutputRange
)
(
,
auto ref OutputRange outputStream
)
if (
isOutputRange!(OutputRange, char)
)

Meta