update shuffle algorithm