Mac resolution/display randomly changed

I recommend you reset your NVRAM. This chip stores information on screen resolution and can often become corrupted. You can reset it by starting your Mac while holding down cmd + opt + P + R . You should hear the Mac chime, restart and chime a second time. Then you can release the keys you are holding. More info here.