Pain Treatment. Unfortunately, although this is a simple question the answer is not. The key to treatment is an appropriate evaluation, the making of a diagnosis, and the development of a treatment plan for that diagnosis. Most headaches are self limiting and resolve shortly. Persistent headaches requires an evaluation by an appropriately trained provider.
Random? I don't quite follow you. ALL migraines are random. That's why they're hard to treat. If you always knew when a migraine was coming, you could always nip it in the bud.
More info required. First you need to be diagnosed with migraines. There are many different types of headaches, more than you can memorize, and migraines are just one type. If you have been diagnosed specifically with migraines, then they are usually associated with sleep patterns, diet, stress, or menstrual cycles. There are other associations as well but less common. You need to pay close attention to figure it out.
Migraine? There are many kinds and causes of headaches. First you need to determine if your headaches are really migraine. You can learn more from the national library of medicine website link to migraine is: http://www.Nlm.Nih.Gov/medlineplus/migraine.Html there are many potential migraine triggers, including aspartame, strong cheeses, chocolate, red wine, bananas, avocados, nitrated meats, etc.