One of n lines in a file: Difference between revisions
Content added Content deleted
Line 1,910: | Line 1,910: | ||
=={{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, Reservior Sampling: https://en.wikipedia.org/wiki/Reservoir_sampling. |
|||
<lang rust>extern crate rand; |
<lang rust>extern crate rand; |
||