Hi Spike,
There are so many things that could be the cause of your computer randomly shutting down. There are a few steps I would recommend to get you started in the troubleshooting process:
1. Try running a cleanup on the computer using software such as "Ccleaner"
2. Run a virus scan through your antivirus (assuming you have one)
3. Download "Malwarebytes" and run a scan
These are the most basic steps I would start with. You haven't given a lot of information on the state of your computer so it sounds like it could be the result of a virus or some malware. Even a not-well optimized computer could be the cause.
Links:
Ccleaner:
https://www.piriform.com/ccleaner/download
Malwarebytes: https://www.malwarebytes.com/
EDIT: DIDN'T SEE...