gen.py revision 49cab51a
149cab51aSShuo Chen#!/usr/bin/python 249cab51aSShuo Chen 349cab51aSShuo Chenimport random 449cab51aSShuo Chen 549cab51aSShuo Chenword_len = 5 649cab51aSShuo Chenalphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-' 749cab51aSShuo Chen 849cab51aSShuo Chenoutput = open('word_count', 'w') 949cab51aSShuo Chenwords = set() 1049cab51aSShuo ChenN = 1000*1000 1149cab51aSShuo Chenfor x in xrange(N): 1249cab51aSShuo Chen arr = [random.choice(alphabet) for i in range(word_len)] 1349cab51aSShuo Chen words.add(''.join(arr)) 1449cab51aSShuo Chen 1549cab51aSShuo Chenprint len(words) 1649cab51aSShuo Chenfor word in words: 1749cab51aSShuo Chen output.write(word) 1849cab51aSShuo Chen output.write('\t') 1949cab51aSShuo Chen output.write(str(random.randint(1, 2*N))) 2049cab51aSShuo Chen output.write('\n') 2149cab51aSShuo Chen 22