I need help with programming random vertices of regular polygon. I want to get a function, where for n regular polygon get vertices of random coordinates. I tried like this but I have to have coordinates of poly. Any help?
import random
def polygon_random_points (poly, num_points):
min_x, min_y, max_x, max_y = poly.bounds
points = []
while len(points) < num_points:
random_point = Point([random.uniform(min_x, max_x), random.uniform(min_y, max_y)])
if (random_point.within(poly)):
points.append(random_point)
return points