by nikcub · 15y ago · 0 comments
word_pass() {
cat /usr/share/dict/words | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2 | head -n 4 | tr "\\n" " " && echo
}
then: $ word_pass
corticifugally tetraploidy democrat vibrionic
(if you notice how this works, you can see that it isn't super-efficient, but it works)I have another version that I use that stuffs srand but in the end I figured srand from a 250k dictionary is still better than picking words out of your head from a ~1k dictionary
The size of the dictionary doesn't matter (given that it's more than about 70 words); the limiting factor is the entropy in the RNG seeding.