Initiative
Initiative is the primary factor in determining the order of attacks, not just unit to unit, but even from Primary and Extra attacks.
If units and/or attacks have the same initiative then their attack order is randomly chosen based on the size of the scale (larger stacks are weighted to strike first when they are the same initiative as smaller stacks).