From 8788e6bd8023dc4b8fe24f22e0bfd85e325658c5 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 27 Dec 2023 18:45:14 +0000 Subject: use shuf correctly to output random lines --- typr.sh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'typr.sh') diff --git a/typr.sh b/typr.sh index 75003be..800b7f1 100755 --- a/typr.sh +++ b/typr.sh @@ -114,18 +114,8 @@ typr_show_results () { } typr_generate_text () { - words="$(printf "%s " $words | shuf)" wordcount=100 - - set -- $words - text="" - - i=0 - while [ "$i" -lt "$wordcount" ]; do - text="$1 $text" - shift - i=$((i+1)) - done + text="$(printf "%s\n" $words | shuf -r -n $wordcount | xargs printf "%s ")" text="${text% }" } -- cgit v1.2.1