I have a shapefile of points representing households in a household survey.
In order to conceal their exact geographic location, I would like to displace these points in a random distance (uniform distribution over 0-2km) and a random direction (uniform distribution over 0-360 degrees).
How can I do this in QGIS?
Although displacing on the x- and y-axis independently creates a random direction, displacing by 2000m on the x and 2000m on the y would lead to more than a 2000m displacement in total. I thought about displacing up to 1414.2135m on both axes, but I wasn't convinced this would generate a uniform distribution over distance (I could be wrong, but I thought it would more likely create smaller distances).
The workaround I came up with was to create a random degree using the field editor rand(0,90) and a random quadrant using rand(1,4). Then I created a random distance using rand(0,2000). Let x* be the displaced x-coordinate of original point; similarly, y* is the displaced y-coordinate of the original point.
In quadrant I : x*=x+distance*sin(degree)
and y*=y+distance*sin(90-degree)
In quadrant II : x*=x-distance*sin(90-degree)
and y*=y+distance*sin(degree)
In quadrant III : x*=x-distance*sin(degree)
and y*=y-distance*sin(90-degree)
In quadrant IV : x*=x+distance*sin(90-degree)
and y*=y-distance*sin(degree)
random points in polygon
tool to generate one random point per buffer polygon. Much simpler than calculating random angles.