Hacker News new | past | comments | ask | show | jobs | submit login

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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: