Its randomness in that the code they use to generate the teams is pretty random, but there is still a specific code, so however it decides the leagues you are more likely to be in the same league with those guys unless you change something from season to season, such as adding a friend