Revert "revert a change in shuffle.py"

This reverts commit a547d1a7b5fc550b47a8aab13b74b20cad2c4d08.