The same troops always appear in the garrison.
In order of preference in humans
priests - archers, / spearmen - swordsmen / and finally horses.
Mummies - acolytes / Skeletons - Scorpions / spiders.
I also believe that it depends on the number of gold units in the garrison.
For example, if you are lich, and you have 20 units of scorpions, 20 gold spiders and 3 units of skeletons, the skeletons will appear when you do not have scorpions ... but if you have 5 units of skeletons, the skeletons have preference over the scorpions.
If you are defended by a player of the same race, the other player's troops have preference over your troops.
And if a player of another race defends you, the combinations are varied and usually makes your wall weaker and more vulnerable, except if a lich protects you in the desert.
Rankan is also good at defending, but most of the time other players' troops mix and lose defensive ability, although with the temples, rankan troops have 25% more damage and life than any other player of another race in the wall.