Formula = Random(modified attack values).
Player with lower modified attack value has a range of his attack-1 to 0
Player with higher modified attack value has a range of lower players modified attack to ubound.
KO gives you extra PERSONAL XP (for your level) if you have extra pills.
Hope that helps.
Player with highest initial attack gets it doubled. This becomes thier modified attack value.