I've added an option in dxcalc to simulate variance to mimic the way the game does. It's a checkbox at the bottom of the page as shown below. It's kind of fun to just click submit and watch the "HP lost" and sometimes number of rounds change. I will go ahead and explain some of how it's implemented and then comment on some unknowns. If I get information that conflicts with what it's currently doing from Freezy or someone like that from Bytro I'll update it.

For each stack in each round of battle a random number between 0.8 and 1.2 is generated. The chance is greater that that number is closer to 1.0 than to the extremes. The following plot shows how this weighting is done. It's a normal distribution with mean = 1.0 and standard deviation = 0.1. For a given stack in a given round the damage potentials against all class types are multiplied by this random number. For example, if the value is say 0.85 then the unarmed and light armored damage potentials are both multiplied by 0.85 for that stack in that round.

There are a few things I'm not sure about.
1. What standard deviation does the game server actually use? I would imagine it isn't greatly different than what I'm using here, but it could be smaller for example. If it was smaller then the change in damage potential wouldn't be as great on average.
2. At what points are new random values generated? I think how I am currently doing this seems reasonable but there are very many possible alternatives/permutations. For example, instead multiplying all the damage classes by the same random value one could generate a new random value for each damage class in each stack. This could be broken down even further so that you select a random value for each damage class of each unit in each stack, etc. It would be nice to know exactly how this is implemented.
For each stack in each round of battle a random number between 0.8 and 1.2 is generated. The chance is greater that that number is closer to 1.0 than to the extremes. The following plot shows how this weighting is done. It's a normal distribution with mean = 1.0 and standard deviation = 0.1. For a given stack in a given round the damage potentials against all class types are multiplied by this random number. For example, if the value is say 0.85 then the unarmed and light armored damage potentials are both multiplied by 0.85 for that stack in that round.
There are a few things I'm not sure about.
1. What standard deviation does the game server actually use? I would imagine it isn't greatly different than what I'm using here, but it could be smaller for example. If it was smaller then the change in damage potential wouldn't be as great on average.
2. At what points are new random values generated? I think how I am currently doing this seems reasonable but there are very many possible alternatives/permutations. For example, instead multiplying all the damage classes by the same random value one could generate a new random value for each damage class in each stack. This could be broken down even further so that you select a random value for each damage class of each unit in each stack, etc. It would be nice to know exactly how this is implemented.