I'm pretty sure it's random, but you can make the sequence a little easier with a high enough science skill.
SWC
Sir Edmund:"Should you obey the lord who asks you to put a village of innocents to the torch? Is that chivalrous? Is it noble?" Me:"It's a great way to get promoted, I know that much."
Even with a high Science skill, I found it very helpful to have a search pattern. Pick a route that you can navigate from terminal to terminal quickly (if you can't remember which terminals you already searched, or if you get stuck on a corner for more than a split second, you're basically hosed and must start over). It's possible but unconfirmed that a high Luck score would help.