Hey, Well first of all, welcome to the forums. You have posted in the right place
Right, well for me, it can be three things.
One, a power supply problem, or two, the hard drive, or both.
I've had it with both, and its done about the same thing. The power supply was faulty and was sending out leathel supply to the hard drive which conked it out and caused it to randomly restart, and completly messed up the hard drive after a while to a point it couldn't run, but was causing random restarts with clicks (the head of the hard drive going into rest position, whih might be sticking since it won't restart after restarting sometimes)
I've also had it with the hard drive causing it on a computer before this one.
The hard drive clicks when it restarts since the head is going back into position, so you can be sure its something to do with this. It then has a choice to freeze or restart to fix thr problem, and its done either on mine.
WHAT TO DO:
So it might be the power supply causing the hard drive to lose power, and then bring it back which makes it restart or freeze since the hard drive has stopped reading data, and so Windows doesn't know what to do, or it could be just the hard drive being the problem.
I'd , if I were you, buy a new power supply, and also a new hard drive, since i wouldn't take risks that you'd buy a new drive, and the power supply would either make it do the same thing, or could damage the hard drive after a while like it did on mine.
I'd then connect this hard drive and power supply up fast, put windows on the new drive, and then select the old drive as a SLAVE to that drive and backup everything on it quick taht you want to keep.
So yeah, I'm pretty sure it's either the hard drive or the power supply causing the problem. So its best just to change both.
When getting a power supply, i'd get a 450watt one. people on this forum might be able to help you with a good make. I'm not one of those people
I hope this helps