update shuffle algorithm.