Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you do this you won't get a uniform distribution on the circle, the points will be the most dense at the center and get less dense as you go towards the edge. To make the points uniform you need to use inverse transform sampling[0], which will give the formula r*sqrt(rand()) for radius poolcoordinate, where r is the radius of the circle and rand() returns and uniform random number from the interval 0 to 1.

[0]: https://en.wikipedia.org/wiki/Inverse_transform_sampling



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

Search: