#sampling #random #permutations #iterable #shuffle #line #text

app shuf-rs

Generate random permutations of an iterable with reservior sampling

2 unstable releases

0.2.0 Jul 19, 2024
0.1.0 Jul 7, 2021

#487 in Command line utilities

Download history 74/week @ 2024-07-13 45/week @ 2024-07-20 3/week @ 2024-07-27 13/week @ 2024-08-24 10/week @ 2024-08-31 7/week @ 2024-09-07 14/week @ 2024-09-14 11/week @ 2024-09-21 29/week @ 2024-09-28

63 downloads per month

MIT license

7KB
131 lines

shuf-rs

Shuffle lines of text with reservior sampling.

Build

cargo build --release

The resulting binary is found under target/release/shuf.

Usage

USAGE:
    shuf [OPTIONS] [path]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -n, --head-count=COUNT <num>    Number of lines to read

ARGS:
    <path>    The path to the file to read

mod shuf

src/shuf.rs contains a reusable implementation of reservior sampling, that works on any iterable.

Dependencies

~4MB
~70K SLoC