Attempt to sort out mutability issue in shuffling