If you have the tile numbers in an array you can push the first element to the back, then pop the first element.
[1,2,3,4,5] - Starting array
[1,2,3,4,5,1] - Push first element to the back
[2,3,4,5,1] - pop the first element from the front
Push the last element to the front and pop the last element to go the other way.