Created
July 11, 2014 07:08
-
-
Save hoffoo/e1013428360375b6a871 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# random words generator | |
dict="/usr/share/dict/american-english" | |
let word_c="$(wc -l $dict | awk '{print $1}')" | |
p=p | |
let oldseed=$(date +%N) | |
random_word() { | |
let seed=`rand -s $oldseed -M $word_c` | |
let nr=$seed%$word_c | |
line=$nr$p | |
oldseed=$seed | |
echo -n $(sed -n $line $dict)" " | |
} | |
for i in $(seq 1 $1); do | |
random_word | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment