its not a random attack if you are close to word wall, the dragon dose not just defend its lair but all the surrounding area
its not a random attack if its a named Dragon (Nahagliiv, Mirmulnir ext)
its not a random attack if its quest related
Random Dragon attacks usually happen by default every 3 Skyrim days & up to 30 days (not sure about that second number, will have to pull out her notes to confirm that one)
what will trigger an random dragon attack is fast travel or carrying to much and walking your way to a town or city
if you have a disease or two and you have like a -25% to all melee attacks or some thing like that & no way of healing your self
if for some funny reason you remove a vital part of your armor ......and have not noticed that you have not put it back on......like the helmet & you lose all the matching Set bonuses from the Armor skill trees.
if you have to escort some one .....has any one noticed that there is a big chance of a dragon attack 50/50% at Riverwood when you arrive there with Esbern
Diplomatic Immunity .....once you change into your party costume and give away all your weapons a dragon will attack if you hang around to long and don't go to the Thalmor Embassy, YES there is a word wall close buy but have tested the theory by taking him out first and still you will get a random attack
PS 1........you get 2 dragons when any parts of the 2 above sections overlap Most common situation is #1 from the blue section overlapping with #1 from the white section
PS 2 .......you can do Bleak Falls Barrow & get the stone ...............the dragon part of the game starts ONLY after you deliver the stone ..............so go and collect as many words of power you can before this, some lairs are a killer especially if they are guarded by legendary dragons .......you get the word and all the loot from the chest with out having to fight the dragon, ..........you can collect around 60% of the words of power even before you kill your first dragon .............the rest of the words are quest related