Python‎ > ‎random‎ > ‎

random.shuffle()


Introduction
The method will shuffle the list items.

Syntax
random.shuffle(x)->list shuffled

Parameters
x=iterable

Examples
The method returns as:
>>>import random
>>> list=[1,3,4,7,4,2]

>>> random.shuffle(x)
>>> x
[1, 4, 7, 2, 4, 3]
>>> 

The equivalent to:
>>>import random
>>> list=["Python", "Research", "Centre"]

>>> random.shuffle(x)
>>> x
['Research', 'Python', 'Centre']
>>>

Comments