With some new Mac hardware on the horizon, lots of folks will be replacing their existing machines with brand new gear. And some of them will be giving their existing machines to other folks. If that’s you, take a read of the linked Apple support article. This is the officially sanctioned way to erase and reinstall OS X.
The instructions show you how to erase your hard drive using Disk Utility (you can even do the DoD-approved wipe your drive 7 times method), then use OS X’s built-in recovery disk to reinstall OS X on the wiped drive.
Needless to say, be sure to back up your hard drive before you even read the instructions.