Imagine something like that in semi-coding (assuming a 3 card pack):
Roll 1d6 (=a)
if (1 OR 2 OR 3): select a common of all the commons available in selected pack (per random)
if (4 OR 5): select an uncommon...
if 6: select a rare
(see a above)
while (a<4 AND b<4 AND <4) Roll 1d6(=c)
(see a above)
NOTE: the numbers are pulled out of my hat. Out of my hat that does not even exist. So it might really be 50% commons, 33% Uncommons, 17% Rare. Might as well be other numbers. And the above is code of no scriptiong language and aimed solely at giving an idea of how it COULD work.
These packs do obviously NOT work like the "real" packs of, say M:TG. They are unlimited edition packs that generate cards as the pack is bought as opposed to some factory making the cards, packing them into packs and taking them to the retailer. Consequently, there is no equal distribution of cards of rarity X in the packs (well... via the statistics, there should be) nor is there a real number of "Only X black loti were ever printed".
The new packs are always one uncommon now...
it's listed in staff announcements...
and the 50 packs are one rare instead of one 5 star...
unfortunately, this limits the potential for getting a rare in a 3 card pack because unless that one uncommon card can also be a rare, then you only have 2 cards that can randomly be a common, rare, or uncommon... instead of 3 random cards.
now, if there is some hidden line of code stating that the one card that is at least an uncommon can also be a rare by random chance, then we increase the chance of getting a rare...
but Code is a tricky game to play, you can't please everybody, and sometimes you make, or break the game.