Actualy , I think , they didnt exactly made it random
I've noticed that some times the 'dungeon' is the same. And (my opinion) there are maby 10 variations of a level and the app just chooses randomly based on that,and then aligns the rest of the levels with that level (checking to see if it rotates the opposite direction (this way will lead back to the first level,and cannot continue)to place the levels in that order so that they lead away from the city)
PS.: There are ways to make some sort of algorythm to generate random 'mazes' but you have to ask for that in Scripting
its a little complicated...