I tried to reset the PRAM ( holt Alt CMD P R after power on your device) but this did not solve the Problem.
After That I tried to reset the SMC. This resolve the Problem on my iMac ( google for SMC Reset it is differnt for some devices)
But the Macbook got still the Problem. I figured out how to see the shutdown reasons! If you open your Terminal and enter the following:
log show –predicate ‘eventMessage contains “Previous shutdown cause”‘ –last 24h
then you can see the shutdown Reasons. My Problem ist -128! If you search for that code, you will see that most people got hardware problem like RAM defects.
But sometimes People say that you have to boot in Safe Mode (Holt Shift while starting your Device). If the random shutdown effect didn’t appear it looks like you have a software Problem).
I wrote this text in the Safemode – I hope i have a Software Problem. But without the log with the shutdown reason code / error codes i did not tests this!