I have a POI point of interest selected at a certain latitude and longitude and I want to generate a few random point that are at most 50 feet away very accurately. I don't want to go over 50 feet but I also want the random point to be evenly distributed up to the 50 feet.
Here is what I have so far, it looks pretty good but it generates distances that are too far away.
My best guess so far is I think many of my assumptions are based on circles instead of spheres.
x0 = Longitude of POI
y0 = Latitude of POI
u = Uniformly random number between [0,1)
v = Uniformly random number between [0,1)
r = 50*0.3048/111,300
r = maximum 50 foot radius distance new point is away from POI
0.3048 is to convert feet to meters
111,300 is to convert meters to degrees for earth
θ (or t) = 2π*v
θ (or t) = Uniformly random rotation around the polar axis
w = r*sqrt(u)
w = Non-uniformly random distance based on polar coordinate system
so points don’t clump near the center.
Δy = w*sin(θ)
Δy = New random delta change to latitude
standard w*sin(θ) for converting from polar to Cartesian coordinates
y1 = y0+Δy
y1 = New random latitude of new point
Δx = w*cos(θ)/cos(y1*π/180)
Δx = New random delta change to longitude
cos(y1*π/180) used to adjust for shrinking east west distances
as you move further away from the equator
x1 = x0+Δx
x1 = New random longitude of new point
Just to add some more context, I'm doing this inside of SQL Server using a WKID 4326 geography coordinate system and checking my work with STDistance.