implement shuffle function to select successors