Per Erik Strandberg /cv /kurser /blog

>>> from random import seed, shuffle
>>> 
>>> seed() 
>>> l = range(0, 20)
>>> l
[0, 1, 2, 3, ...19]
>>> 
>>> 
>>> shuffle(l)
>>> l
[9, 5, 8, 4, ... 7]
>>> 
>>> seed(1337)
>>> l = range(0, 20)
>>> shuffle(l)
>>> l
[15, 14, 7, 8, ... 12]
>>> 
>>> l = range(0, 20)
>>> shuffle(l)
>>> l
[15, 2, 4, 0, ... 6]
>>> 
>>> seed()
>>> l = range(0, 20)
>>> shuffle(l)
>>> l
[2, 7, 1, 0, ... 5]
>>> 
>>> seed(1337)
>>> l = range(0, 20)
>>> shuffle(l)
>>> l
[15, 14, 7, 8, ... 12]
>>> 
>>> l = range(0, 20)
>>> shuffle(l)
>>> l
[15, 2, 4, 0, ... 6]
>>> 


This page belongs to Kategori Programmering