Random point in a circle

Demo: Edit fiddle - JSFiddle - Code Playground

Have a few different explanations…

Change the circle into a triangle (or rectangle) and pick a point inside. The a/b formulation.

Expand the circle out and “map it” onto the triangle, then do the inverse mapping back onto the circle.

Idea: Have a simulation you can play with as well. To see exactly HOW these nearby squares are getting over-represented. They capture more than their fair share.

Insight: This skewed distribution might be correct! If you stand in the center of a field, and throw rocks at random angle and random distance, that’s the pattern you’ll get.

Maybe press a button to pick your angle, and to pick your distance. See what happens. [In the simulator].


How to figure it out:

  1. Visually / geometrically

  2. Analytically with calculus

Can see that each bit of radius contributes 2pir to the shape. (dA/dr = 2pir)

That means more area is coming from the later additions, and it needs to be weighted like that. The pdf is 2 * pi * r, and the cdf [cumulative] is the integral of that, or pi r^2. Might normalize this down though.

Basically, we want equal distribution with regards to AREA, so we need to look at how area is built, and randomize the factors accordingly.