First the equations themselves:
Initial inputs:
Rear = Radius of the Sphere in question
Slat = Starting latitude (in radians - -pi/2 < Slat <= pi/2)
Slon = Starting longitude (in radians - -pi < Slon <= pi)
Bmin = Lower bearing bound (in radians - 0 <= Bmin <= Bmax)
Bmax = Upper bearing bound (in radians - Bmin <= Bmax <= 2*pi)
Dmin = Lower distance bound (0 <= Dmin <= Dmax)
Dmax = Maximum distance bound (Dmin <= Dmax <= pi*Rear)
Randomizers:
Zber = Random number seed for Bearing (0 <= Zber <= 1)
Zdis = Random number seed for Distance (0 <= Zdis <= 1)
Intermediate Variables:
Rber = Random Bearing within given parameters
Rdis = Random Distance within given parameters
Dlon = Change in Longitude from Start to Finish (-pi < Dlon <= pi )
Final Values:
Flat = Finishing Latitude (in radians - -pi/2 < Flat <= pi/2)
Flon = Finishing Longitude (in radians - -pi < Flon <= pi)
Equations (computed in order):
Rber = (Bmax-Bmin)*Zber+Bmin
Rdis = Rear*acos(Zdis*cos[Dmax/Rear]+[1-Zdis]*cos[Dmin/Rear])
{Final Result} Flat = asin(cos[Rber/Rear]*sin[Slat]+sin[Rber/Rear]*cos[Slat]*cos[Rber])
Dlon = sign(sin[Dber])*acos([cos{Rber/Rear}-sin{Slat}*sin{Flat}]/[cos{Slat}*cos{Slon}])
{Final Result} Flon = Slon+Dlon-2*pi*floor([Slon+Dlon+pi]/[2*pi])
Now, since most navigation is done in degrees minutes and seconds rather than radians, some conversion of your starting position into radians at the begining is necessary and back to DMS at the end. But that conversion is trivial so I won't repeat it here.
If anybody finds any errors in the above, please let me know!!
Here are a couple of the quickbasic programs I use for finding random spots:
Plotted many points within a certain heading and distance range from an origin, used to test if I had the math right
This is the most general of the lot, lets you specify your starting point and ranges for the distances and bearing you want a random spot within
This does finds a random spot within a certain distance using a much less efficient method (generate random spots anywhere in the world until you get one close enough).
This one was modified to be preset to have a range for distance and bearing which results in random spots anywhere on the Earth
The most current is of course the Javascript version.