summaryrefslogtreecommitdiff
path: root/random-words
blob: 98fb2037694954c54d9916f0f06a85a4cd23a0eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#
# random-words
#
# Trivial script to generate a random list of words
#
# Copyright (c) 2021-2023 Steve McIntyre <steve@einval.com>
#
# License: MIT/Expat (https://opensource.org/license/mit/)

NUM=$1
if [ "$NUM"x = ""x ]; then
    NUM=10
fi

grep -v "'" /usr/share/dict/words | \
    awk '
    	BEGIN {
	    srand()
	}
	{
	    print int(rand() * 1000000), $0
	}' | \
	    sort -n | \
	    awk '{print $2}' | \
	    head -$NUM | xargs echo