One of n lines in a file: Difference between revisions

Content added Content deleted
mNo edit summary
Line 1,912: Line 1,912:
=={{header|Rust}}==
=={{header|Rust}}==
{{libheader|rand}}
{{libheader|rand}}
You could also use `rand::seq::sample_iter` which uses the more general version of this algorithm, Reservoir Sampling: https://en.wikipedia.org/wiki/Reservoir_sampling.
You could also use `rand::seq::sample_iter` which uses a more general version of this problem, Reservoir Sampling: https://en.wikipedia.org/wiki/Reservoir_sampling.
<lang rust>extern crate rand;
<lang rust>extern crate rand;