GenerateRandomSearch

Random Polygon Generator

Random points joined in the order they were drawn make a self-intersecting tangle far more often than a shape. Sorting the vertices by angle about an interior point fixes that by construction — the result is star-shaped and therefore simple — and every polygon here is still checked edge against edge before it is shown, because a construction argument is not a test. The area comes from the shoelace formula and the convexity from the sign of the turns.

What this generator does

Places vertices at distinct angles about a centre with varying radii, sorts them by angle, and joins them. The result is a simple polygon — no two edges cross — with its area, perimeter, centroid and convexity computed from the finished vertices.

How to use this tool

  1. Choose how many vertices you want.
  2. Tick convex only if you need every interior angle under 180 degrees.
  3. Generate, and read the area and perimeter alongside the shape.
  4. Copy the coordinates, or seed the shape to get it back later.

Understanding the controls

How many vertices
Between 3 and 12. More vertices make reflex corners more likely, which is what stops a polygon being convex.
Convex only
Fixes every vertex at the same distance from the centre, which forces a convex shape at the cost of making it regular.
Seed
Any word reproduces exactly the same polygon, which matters if you are using it as a fixture.

Common use cases

  • Test data for anything that consumes polygon geometry
  • Demonstrating the shoelace formula on a shape that is not a rectangle
  • Showing the difference between simple and convex with concrete examples
  • Generating shapes for a drawing or clipping exercise
  • Reproducing the same polygon in two places from one seed

How this generator works

Angles are drawn with a minimum separation so no two vertices coincide, then sorted. The check tests every pair of non-adjacent edges for a crossing, recomputes the area and perimeter from the vertices, and confirms the convexity claim against the sign of each cross product.

Randomness and fairness

The angles and radii are random; that the polygon is simple follows from sorting them and is verified afterwards. Seeded shapes are reproducible and therefore explicitly not cryptographically secure. Unseeded, the browser's cryptographically secure generator supplies the draws.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Every polygon here is star-shaped about its centre, which is a subset of simple polygons rather than all of them.
  • Polygons cannot have holes, and the vertices always run anticlockwise.
  • Coordinates sit on a fixed hundred-by-hundred square, so there is no scale or unit.
  • Convex mode produces regular polygons, which is a stronger property than convexity.
  • Shapes are not stored between visits; seed one you want to keep.

Privacy and your data

Vertices and measurements are computed in your browser. Nothing about the shape or your seed is transmitted or retained.