Each background related to a variable value, varBG=1 = sunset, varBG=2 = valley etc. Have a global variable that is a score accumulator and reset on every 10. When globalvar = 10, choose(1,2,3,4,5) however many backgrounds there are, it'll choose a random number. You could run a function with this value as a parameter, a change background function where if 1 is chosen it chooses the sunset background, 2 it sets the valley etc.
You don't need to determine which background to fade. You can put them into a backgrounds family with a family fade behaviour. Then just before the change background function you can select family > fade.