I'm looking for a better way to randomly select an item from a list in Python. I've done some research. My goal is to select a random element from the randomName() function.
import random
def randomName():
names = ["Morpheus","Neo","_from_redpills","Agent Smith","Trinity"]
num = random.randint(0, len(names)-1)
return names[num]`
for z in range(5):
print randomName()