update the algorithm of generating trial sequence