Regardless of whether they're called viruses or malware, random restarts are not a typical symptom of "infection," on any OS. While it may be convenient to blame viruses, UFOs, or the devil for unexplained phenomena, chances are that there's a different, far more mundane cause.
Computers and the software that runs on them are incredibly complex, and complex systems would be prone to inexplicable failures, even if malice and evil did not exist. There are many known issues with hardware and software that can randomly crash/restart a computer - some will keep reoccurring until the cause is located, some will happen once or twice and not return.
System logs can be helpful in locating the issue - at the least, they'll point to the last thing that happened before the crash - maybe it caused the crash, maybe it didn't. One thing is certain about logs - it takes some experience and knowledge to understand what they say. Feel free to look at them - go into your Applications > Utilities folder, and open Console. (Hint: Console Help can be your friend)
By all means, install an anti-malware program - just don't expect it to solve the issue. (And if the problem doesn't return, don't assume that the anti-malware program fixed it - coincidence is king!)