An additional level of randomness gets a lot closer to the theoretical distribution.

Generating 1 million numbers using the formula

randint(1, randint(1, randint(1, ranges_top))), where ranges_top is still 999,

produces this result.

{1: (0.31, 0.3), 2: (0.19, 0.18), 3: (0.13, 0.12), 4: (0.1, 0.1), 5: (0.08, 0.08), 6: (0.06, 0.07), 7: (0.05, 0.06), 8: (0.04, 0.05), 9: (0.04, 0.05)}

An additional level of randomness beyond three makes the result worse. So it's not a matter of converging to the result.

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.