Random restarts are often caused by overheating, drivers, or power problems.
1. Check for overheating
Clean dust from vents and fans.
2. Turn off automatic restart
System Properties > Advanced > Startup and Recovery, untick Automatically restart to see error messages.
3. Update drivers and Windows
Faulty drivers commonly cause crashes.
4. Check the power supply
A failing power supply can cause restarts on desktop PCs.
5. Run memory diagnostics
Search Windows Memory Diagnostic and run it.
6. Scan for malware
Run a full scan with Windows Security.