Merge pull request #9 from uttamo/patch-1

Use random.choice instead of random.randint
This commit is contained in:
Michael Herman 2017-09-29 07:17:45 -06:00 committed by GitHub
commit c2f695f649

View File

@ -1,4 +1,4 @@
from random import randint
from random import choice
def random_name_generator(first, second, x):
@ -10,13 +10,8 @@ def random_name_generator(first, second, x):
- number of random names
"""
names = []
for i in range(0, int(x)):
random_first = randint(0, len(first)-1)
random_last = randint(0, len(second)-1)
names.append("{0} {1}".format(
first[random_first],
second[random_last])
)
for i in range(x):
names.append("{0} {1}".format(choice(first), choice(second)))
return set(names)