Refactor common code into higher-order function
When using 'random', all lights should have the same color.