======= update ===========
I guess a general method (to get elongated polygons too) would be to sample elliptic shapes of various axis ratios at a few points and then perturb them outwards (inflate) randomly.
ngon[n_, s_, r_] :=
Polygon[RandomReal[r, n] Table[{s Cos[2 Pi k/n], Sin[2 Pi k/n]/s}, {k, n}]]
Table[ngon[RandomInteger[{7, 13}], RandomInteger[{1, 3}],
RandomReal[{1, 2}]] // Graphics, {5}, {5}] // GraphicsGrid
======= older ===========
Maybe this post is useful to read - there is some sorting points discussion:
Character edge finding
Another idea that does it in a simple way is a perturbative approach. Start from a regular polygon and randomly perturb the vertices. Note it will keep polygons within some bounding box defined by regular polygon side and max perturbation amplitude.
For positive-negative perturbations smaller than some number self-intersections will be impossible. For another positive only perturbations and a different "smaller than number" you will have only convex polygons. The value of these "smaller than numbers" can be found from geometric considerations that I leave to you.
For arbitrary concave and convex shapes define:
ngon[n_, r_] :=
Polygon[Table[RandomReal[{-r, r}, 2] + {Cos[2 Pi k/n], Sin[2 Pi k/n]}, {k, n}]]
Table[Graphics[ngon[RandomInteger[{3, 9}],
RandomReal[{.3, .7}]]], {5}, {5}] // GraphicsGrid
Here is the limiting case of perturbing a line:
n = 7; pts = Table[k/n, {k, -n/2, n/2}];
Table[Join[{RandomReal[{1.1, 1.5}] #, RandomReal[{0, .2}]} & /@
pts, {RandomReal[{1.1, 1.5}] #, RandomReal[{0, -.2}]} & /@ pts //
Reverse] // Polygon // Graphics, {5}, {5}] // GraphicsGrid
For shapes only convex (with another "less than" parameter):
ngon[n_, r_] :=
Polygon[Table[RandomReal[r, 2] + {Cos[2 Pi k/n], Sin[2 Pi k/n]}, {k, n}]]
Table[Graphics[ngon[RandomInteger[{3, 9}],
RandomReal[{.3, .4}]]], {5}, {5}] // GraphicsGrid
RandomReal
or similar. Please add as much info as possible and any relevant code you already have in place. $\endgroup$Graphics@Polygon[RandomReal[{5, 10}, {RandomInteger[{2, 10}], 2}]]
or similar? $\endgroup$RandomReal
orRandomInteger
can do - might yield a self-intersecting polygon, which I wish to avoid. I have elaborated on that in my edit to the question. $\endgroup$