The spawning is random, but Barbarian AI isn't completely random: if I remember correctly, it executes an AI warplan just like any other AI race, which targets one specific civ at a time. Every X turns it switches to a new civ, weighted towards higher scores. To see this in action, put on raging...