I've had my 2011 Mac Mini for a while. About a year ago the internal HDD decided to give up. Oh well.
I just now finally got around to being able to replace the hard drive. I decided to go with an SSD (a Samsung 850 PRO, got it from Amazon here). Installed OS X 10.10.4 (have an application that is broken on 10.10.5+ unfortunately).
So after all of this I've been using it for about a day. Over that day it has seemingly restarted itself several times while it was idle and nobody was looking (meaning the monitor was off and nothing was connected over VNC, but apps, mainly chrome, were running – nothing uncommon and that I haven't used on other Macs with no issues).
The only clue I can see (not that I exactly know what I'm looking for) is in Console. I get an error message stating kernel[0]: Previous shutdown cause: -128
.
I did have previous errors with this machine where it would randomly restart every once and a while, where I couldn't figure out a rhyme or reason, but these were way more infrequent and happened no more often or differently than other Macs I have. Certainly not 3 or 4 times in a day.
Best Answer
Shutdown cause -128 is "hardware" related; most times, I have noticed it's related to memory.
What you can try:
If your memory tests come back with errors, remove one module and try again. Make sure you tests each module individually in each slot individually. You want to see if the problem (if it exists) stays in the same location (slot is bad) or moves (memory is bad)