local pPromotionList = {GameInfoTypes.PROMOTION_X, GameInfoTypes.PROMOTION_Y, GameInfoTypes.PROMOTION_Z}
function GiveRandomPromotion(ePlayer, iCity, eUnit, bGold, bFaithOrCulture)
local pCity = Players[ePlayer]:GetCityByID(iCity)
local pUnit = Players[ePlayer]:GetUnitByID(eUnit)
if pCity:GetNumBuilding(GameInfoTypes.BUILDING_X) > 0 then
pUnit:SetHasPromotion(pPromotionList[math.random(1,#pPromotionList)], true)
end
end
GameEvents.CityTrained.Add(GiveRandomPromotion)