I have been following the thread Willem, but I was under the impression the smaller city would have gotten the holy city. So I am not understanding why it didn't. Both cities had exactly one relgion (pop 2 had Budda and Pop 1 had Confu). Pop 1 city was closer to my capital but other then that what made it go to the other city if not some roll between them?
A city is more likely to roll a higher RNG result the greater its population. That is in the above formula. It should be noted the city with the highest result gets the religion, if that wasn't clear before.
For your two cities, it was still a random roll, but that bigger city was slightly more likely to get the religion than the smaller city.
Proximity to the capital has no relevance whatsoever. That should be clear from the formula too.