When I go to Vector > Research Tools > Random Points in Polygons in QGIS, I can specify a specific number of points I can add randomly into each feature (each polygon for me). So if I have 15 polygons, and I choose 1 point, I will find 1 point placed in each polygon in a random location.
However, I want to pre-specify a global number of points which are randomly added across all polygons. So for example, let's say I have 20 polygons and I specify 30 points to be randomly added across all of them (with an equal probability of appearing in each polygon). In this case, on average each polygon will end up with 1.5 points, but some may, by random chance, have 3, some may have 0 etc. Also, let's say I have 20 polygons and I specify 15 points. In this case, I will find out that by random chance at least 5 of my polygons end up with no points, and probably more than 5 because again, by random chance, probably a few polygons will end up with two or more points.
Is there a way to do this with QGIS?
Best Answer
You can use pyqgis.
This will list all features, select from the list n times and create a sample list, randomly place a point within each sample: