random blinking without delay and blinking with delay in 1

In order to flip a pin's state, use "digitalWrite(pin, digitalRead(pin) ^ 1)". Using "!" (not operator) is confusing since it is no boolean.