random picks from a list

Sean Ross frobozz_electric at hotmail.com
Thu Jun 12 22:07:25 CEST 2003


Use random.choice(seq). Here's a quick example:

>>> seq = range(10)
>>> import random
>>> random.choice(seq)
2
>>> random.choice(seq)
4
>>>






More information about the Python-list mailing list