An easy way to do this is to use the following three steps:
- create blocks (2d list);
- shuffle this list; and
- merge these lists again.
So:
import random
If you do not want to save data in data , you can simply use:
data = [b for bs in blocks for b in bs]
For this data, I received:
>>> data [3, 4, 1, 2, 5, 6]
second time:
>>> data [5, 6, 1, 2, 3, 4]
source share