Mac OS X has a number of security and power features that let you customize how your laptop is secured and saves energy. If your MacBook is randomly restarting, this can be the result of a change in some of these settings. Alternatively, this can be a sign of deteriorating hardware, such as your logic board, or a system flaw.