Benford's law with random integers I tried testing random integers for compliance with Benford's law, which they are apparently supposed to do. However, when I try doing this with Python,

map(lambda x:str(x)[0], [random.randint(0, 10000) for a in range(100000)]).count('1')

I get approximately equal frequencies for all leading digits. Why is this the case? Might it have something to do with how the pseudorandom number generator, the Mersenne twister, works?

Benford's law applies only to distributions that are scale-invariant and thus applies approximately to many real-life data sources, especially when we measure with arbitrary units: If the leading-digit distribution of a sample is essentially the same whether we measure in inches or centimeters, this is only possible if the logarithm is equidistributed (or approximately so over a range wide enough to cover several orders of magnitudes).
