LANGUAGE » PYTHON » PACKAGE

Random

Usage

python
import random

Shuffle a list in place:

python
random.shuffle(my_list)

Choose randomly an element from a sequence:

python
random.choice(my_list)
random.choice(tuple(my_set))