^ Since it happens randomly I would try running Memtest. Do they have Memtest for OS X?
If all is good run Prime95.
If all is good then run APPLEJACK. That'll fix a lot of problems associated with system cache, preferences files, and it'll fix damaged files and what not.
Once APPLEJACK is installed you need to reboot and press Option + S key or something (I forgot exactly what keys). Type the command "applejack AUTO". Make sure the AUTO is in all caps.