Step4: Implement the shuffle function