In the released version more or less random, but with modifiers.
In KM a more Pseudo Random way.
But both are influenced by the ships size, the target ships size, the sensor range and most importantly, the amount of power allocated to the sensors.
This was done to encourage strategy in games.
For instance, in the FTB (Favour The Bold) mod every ship was basicly underpowerd.
So you were forced to drop some power from sensors to go into "high" speed, before cutting power power to impulse and increasing sensors and weapons. All that and going into a spin to save on the shields.
[EDIT] Pseudo Random is "predictably" random, or "consistently" random. This is needed for MP games.