its called speed tie, it will depend on luck, if I understood you correctly, you mean if a timid gengar with 31 IV and 252 EV in speed VS a timid gengar with 31 IV and 252 EV in speed who will attack first in this occasion ? well this is called a speed tie with a random choice of who will attack first.