Hacker News new | ask | show | jobs
by goblin89 5411 days ago

    sh -c 'cat /usr/share/dict/words | sed -n $(echo $((`cat /dev/urandom | od -N3 -An -i` % `cat /usr/share/dict/words | wc -l`)))p'
This is closer, although you might get sed: illegal option occasionally, I guess. I'm yet to learn how to generate a random number within given limits with bash. Oh wait, we can use Python can't we?

    sh -c 'cat /usr/share/dict/words | sed -n $(echo $((`python -c "import random; print random.randint(1,234935)"` % `cat /usr/share/dict/words | wc -l`)))p'