final solution of shuffle() method