diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | shuf | 0 | ||||
-rw-r--r-- | shuf.sh | 18 |
4 files changed, 20 insertions, 1 deletions
@@ -9,6 +9,7 @@ nproc pinky printenv readlink +shuf seq stdbuf tac @@ -1,7 +1,7 @@ .POSIX: PROGRAMS=arch base64 factor hostid mktemp nproc pinky printenv readlink \ - seq stdbuf sync tac uptime users vdir yes + seq shuf stdbuf sync tac uptime users vdir yes all: $(PROGRAMS) @@ -0,0 +1,18 @@ +exec awk "$(tail -n +2 $0)" "$@" + +{ + lines[NR] = $0; + printed[NR] = 0; +} + +END { + nprinted = 0; + while (nprinted < NR) { + line = int(rand() * NR); + if (!printed[line]) { + print lines[line]; + printed[line] = 1; + nprinted++; + } + } +} |