Skip to content

Commit

Permalink
Script to generate random words.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Hogg committed May 23, 2014
1 parent decf98b commit 000cd54
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions random_words
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/python

import random
import sys

word_file = "/usr/share/dict/words"
word_list = open(word_file).read().splitlines()
num_words = int(sys.argv[1]) if len(sys.argv) > 1 else 1

print ' '.join(map(lambda x: random.choice(word_list), range(num_words)))

0 comments on commit 000cd54

Please sign in to comment.