So I'm doing a dark comedy setting where, among other things, the main faction utilizes a random number generator when it comes to its military formations.
Basically, the inspirations that I'm drawing on, and then parodying; is the early Makedonían Phalanx (ten by ten strong or sixteen by sixteen strong ) as under Philip II, as well as the Gewalthaufen of the Swiss Confederacy (ten by ten strong). Yes, I am very well aware that other authors and texts go into much more detail, like; Asclepiodotus, Aelian, LeoVI's Tactica, Phocas' Tactica, Maurice's Strategicon, De Re strategica, De re militari, Sylloge Tacticorum etc.
To cut the long and short of it, this nation with a Carolean level of technology absolutely loves 'neat square numbers'. Not just militarily, but in terms of architecture. This nation is very very hierarchal (it's a absolute monarchy) with strict social etiquette, over-the-top courtly protocols and a stubborn resistance to change. In terms of the terrain where most of the battles happen, lots of steep valleys.
However, when it comes to the military, whilst still doing their utmost to maintain perfect squares (and uniforms) on the field, (i.e., a unit might be formed up as 5x5 or 10x10) soldiers are assigned to their allotted place in each square via a random number generator (just go with it) irrespective of how they are armed (i.e., service member #12 with a pike could find himself on the very first rank the one battle, and then the next find himself 5 files back while service member #93 with a musket could conceivable find themselves unable to fire at all because they've spent the last 3 battles in the 98th file). Or in simpler terms, every square formation is going to look a messy hodgepodge with weapons of all makes all over the show.
My problem: I need to find a rationale for why this institutionally chaotic and highly nonsensical system can even exist in such a ultra-stratified and rigid society. Preferably without the answer being 'it works because their enemies are more moronic'.