ramdom でshuffleすると、return Noneになる問題
こうすればいいらしい。
>>> import random >>> x = ['foo', 'bar', 'black', 'sheep'] # O(N) operations・・・shuffle と同じロジック >>> random.sample(x, len(x)) ['bar', 'sheep', 'black', 'foo'] # O(NlogN) operation >>> sorted(x, key=lambda k: random.random()) ['sheep', 'foo', 'black', 'bar'] >>> x ['foo', 'bar', 'black', 'sheep']