Flattener vs. Random
Remember there is more than one wave in the air, typically. So even if your random movement is completely random, once you layer a few different waves on top of each other, the first wave constrains the second wave which causes a more predictable profile. What flattening does that random movement doesn't is put that extra effort in to reach the further angles, effectively lowering the peak hit probability. You also have access to bullet shadows, letting you reduce your accumulated hit probability even further.
The exact implementation of causes the stats to diverge so rapidly that I don't think this is really possible to exploit. Certainly I've tried, even looking at both sides of the stats to see if I could make something that works, as have many others, in many weird and wonderful ways.
However even the best anti-surfer guns have lower hit rates against any surfer with flattening, than a relatively simple KNN gun gets against the best Random movements (IMO Raiko, not much has improved since then). So I would call this approach impossible, and instead you just need to try to adapt as fast as possible for anti-surfing, and use different types of stats that they don't have, not try to simulate their dodging of their simulation of your gun.