summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-07-29 10:36:01 -0400
committerJakob Kaivo <jkk@ung.org>2019-07-29 10:36:01 -0400
commitaf303b9fe0143ef3c9aae97df0090eec22938aef (patch)
treef4e67110b008b97e44e96a5b919ccbe892499bba
parent4c16e777b2994a0aa962a9e7bc1bda7e4f8676fd (diff)
call srand() to seed PRNG
-rw-r--r--shuf.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/shuf.sh b/shuf.sh
index d0fe4fb..8fa7d8a 100644
--- a/shuf.sh
+++ b/shuf.sh
@@ -7,6 +7,7 @@ exec awk "$(tail -n +2 $0)" "$@"
END {
nprinted = 0;
+ srand();
while (nprinted < NR) {
line = int(rand() * NR);
if (!printed[line]) {