I have three very similar algorithms generating very different results. In all of them I'm calculating distribution of first number of random number.
First algorithm Here I'm generating random numbers from set $\{ 1, \ldots, 999999 \}$. Result is like uniform distribution.
Second algorithm There are random numbers chosen from set $\{ l, \ldots, u \}$ where $l$ and $u$ are random numbers for every random number generated. Result is like normal distribution.
Third algorithm In this algorithm I'm generating random numbers from set $\{ 1, \ldots, u \}$ for some fixed $u$. Result is like exponential distribution.
Why those weird things happen?
This is an example of Benford's law. The results of your first algorithm should not be surprising, as $\frac 19$ of the numbers have each leading digit. You can prove this by counting them in each decade. The other extreme would be to select a number at random from the set $\{1,\dots,199999\}$. Now a little over half the numbers have leading digit $1$. If you draw numbers from $[1,k]$, the density of leading $1$'s oscillates between (about) $\frac 59$ and $\frac 19$. The density of leading $9$'s oscillates between $\frac 1{18}$ and $\frac 19$.