Urban form as a stochastic equilibrium