It is based on map position. Takes major roads, creates very arbitrary loopbacks and directional mappings. If there aren't enough roads it will tell you to move the map. On desktop at least.
My first random placement took me to a grid that was oriented Northeast-Southwest instead of North-South. It controls very poorly in that case.