This is a revised random-point-in-polygon function first discussed in my earlier post . It turns out that in some weird cases (multipolygon...