Put the background in front of the camera during the game

Hello every body. i want to create infinite road game i made 10 background sprites and put two of them i the scene to start . want that when the camera has moving over the first background the game choose the next background randomly
and put that in front of camera. and doing this while the game over . how can i do this ?

Try this, create a sprite array, put all of them inside the array. then update with the camera movement. use the random function from 0 to 9, being the number the id of the background in the array. Easy.