Combining an LDR sensor with random blinking

Probably not.
Look at how "loop" well, loops, so things repeat.
A digitalWrite will turn the LED either fully on or fully off (which is which depends on how you've wired the LED).