A more rare cause of a computer shutting down randomly can be a computer virus. Some computer viruses will actually shut off your computer, and then turn it back on. These viruses are usually activated by a certain thing you do on a computer, whether it’s a keystroke or opening a particular program.