What I have:
- Latitude/Longitude
- Minimum distance in kilo meters eg 0.3
- Maximum distance in kms eg 1.5
I have to pick a new location randomly which should be at least 0.3 kms and at max 1.5 kms away from the given location. ie This new location I have to choose can be anywhere between 0.3 km and 1.5 kms away from the given location in any direction.
Note: I have to implement this in Elixir(Programming) language but mathematical formula or pseudo code is fine
Another answer helped me to randomly generate a location uniformly in any direction. Below are the steps
dx = [0.3..0.7] x cos([0..2] x pi)dy = [0.3..0.7] x sin([0..2] x pi)r_earth = 6378and then you can do
Here is implementation in Elixir language