Should be RNG. I think the only guarantee is that it will match your spec if it's your first one.
I read up on this some time back and basically, the Heirlooms have
Bad Luck Protection on them (and this is by difficulty too, so doing Normal and Flex in the same week doesn't mess with that).
So one way or another, your chances of getting them keep going up if they don't drop.
And yes, the first Heirloom you get on a character is determined by whatever loot spec you have on at the time.
So say for example if you're a Frost DK with loot spec set to Frost, you're getting either the 2H Axe or 1H Sword.
If you wanted to rig your chances, you'd swap loot spec to Blood for the guaranteed 2H Axe.
Once again though, that's set by difficulty, so if you get your weapon of Flex, that won't affect your chances on Normal.
So say Mr. Frost DK from above got his weapon from Flex, then the first Heirloom he gets off Normal would still be tied to his loot spec (and then it's random after that).