2 ms·
Consider a two digit number. With this algorithm, half of the numbers generated will be less than 10, and half will be 11-99. Likewise with the full 100 digits
by fourthark 7y ago
Consider a two digit number. With this algorithm, half of the numbers generated will be less than 10, and half will be 11-99.
Likewise with the full 100 digits this algorithm has a 1% chance of generating a number less than 10, while the correct proportion would be 1e-100.
The algorithm also does not generate numbers with zero in them (presumably to avoid leading zeroes, but this will skew results somewhat).
I think the correct algorithm would be to generate 100 digits and then remove the leading zeroes.