This question already has an answer here:

I would like to achieve something similar to the ArcGIS Create Random Points tool using geopandas, shapely, or rasterio. I aim to have a polygon with some holes in it (removed by subtracting buffered points). I would then like to randomly sample from the remaining polygon.

The procedure is (broadly) explained in this link however this is not detailed enough to actually implement in python.

Perhaps there is a more rudimentary, or fit-for purpose method. How can I start building a function that does this?

marked as duplicate by MappaGnosis, John Powell, artwork21, whyzar, Jochen Schwarze Mar 13 at 18:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Do you want an equal number of points per polygon or weighted by area? – John Powell Mar 13 at 16:34