There is a polygon of arbitrary shape, the coordinates of the vertices are known. How can I randomly choose a random point so that it is in it , and not on the border or at all outside its region.
At the moment, thought so
1) Take the highest, lowest, rightmost, leftmost and connect them so that the figure "fit" into the rectangle.
2) Take random points from a rectangle
3) Check for belonging to a polygon
4) If not, repeat.
But something I do not understand how to perform the third.