Random restarts are most commonly caused by overheating (the
cpu has a heat sensor and when it reaches a critical point it shutdown or restart). Open the case and check that all fans are working(look for fans on the
CPU, graphics card, power supply and sometimes on the motherboard chipset . Also look for fans/heatsinks that are clogged/blocked with dust and fluff.
If overheating is not the problem you might want to try disabling the "System Failure Automatically Restart" option System Properties (Advanced, Start Up & Recovery). This should prevent the PC from resatarting and give you a chance to try and find what is causing the problem.