This is something you need to have checked out ASAP. Rapid heartbeats can lead to heart attacks. A qualified doctor should make the determination of why your heart is racing. There are reasons that it may race as interaction with drugs, stressful situations, very unusual with eating. Please speak with your doctor or get to the emergency room if it happens again. Nothing to fool around with. Rapid heartbeat can be atrial fibrillation
and both need professional help. PLEASE SPEAK WITH YOUR DOCTOR ASAP. He may need to refer you to a cardiologist ( heart specialist). When it comes to the heart do not second guess or wait, it could be serious.