diff options
author | davidovski <david@davidovski.xyz> | 2023-12-27 18:45:14 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-12-27 18:45:14 +0000 |
commit | 8788e6bd8023dc4b8fe24f22e0bfd85e325658c5 (patch) | |
tree | 0644f3bc6a439132893c40f4265e58ee8a3eb6ee | |
parent | 9ff1c1dba2657557d1d6f5dbf939eb45257a14d4 (diff) |
use shuf correctly to output random lines
-rwxr-xr-x | typr.sh | 12 |
1 files changed, 1 insertions, 11 deletions
@@ -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% }" } |