Does it change every time or is it just random?
If Pokémon are moving with the same priority, Pokémon with higher Speed at the start of any turn will generally make a move before ones with lower Speed; in the case that two Pokémon have the same Speed, one of them will randomly go first.
source
It is random who goes first and it switches back and forth. But the chances of two pokemon having the exact same speed is low.