I don’t believe this is going to do what you want it to do. Of greatest concern is the “Every 5 minutes” part.
Essentially when the conditions are met, this piston will indeed run every 5 minutes. And it will generate random times and turn the lights on and off randomly. But because it’s running every 5 minutes the net result might be that the lights just look like they are ON and they stay ON all night.
I don’t think the Every 5 minutes is the right way to kick something like this off.
What’s the real goal here?