# RandomPolygon

gives a pseudorandom simple polygon with n vertex points.

RandomPolygon[spec]

gives a pseudorandom polygon with the specified specification spec.

RandomPolygon[spec,k]

gives a list of k pseudorandom polygons.

RandomPolygon[dspec,]

gives a pseudorandom polygon in dimension d.

# Details and Options  • RandomPolygon gives a Polygon drawn from a specific distribution.
• RandomPolygon is typically used in testing and verification of time complexity for algorithms.
• Possible specifications spec include:
• {"Convex",n} convex polygons with n vertex points {"Simple",n} simple polygons with n vertex points {"StarShaped",n} star‐shaped polygons with n vertex points {"ConvexHull",dist,n} convex hull of n random points from the distribution dist
• gives a pseudorandom simple polygon with the number of vertex points chosen in the range {3,15} with equal probability.
• is equivalent to RandomPolygon[{"Simple",n}].
• RandomPolygon[{"ConvexHull",n}] gives the convex hull of n random points from the uniform distribution over the unit square.
• RandomPolygon[spec,{k1,k2,}] gives a k1×k2× array of pseudorandom polygons.
• RandomPolygon gives a different sequence of pseudorandom polygons whenever you run the Wolfram Language. By using SeedRandom, you can get a repeatable sequence.
• RandomPolygon has the same options as Polygon with the following additions:
•  DataRange Automatic the range of vertex points to generate WorkingPrecision MachinePrecision precision of vertex points
• With the default setting DataRange Automatic, coordinates are chosen in the range 0 to 1.

# Examples

open all close all

## Basic Examples(3)

Generate a random polygon:

 In:= Out= In:= Out= Generate a list of random convex polygons:

 In:= Out= Compute the area:

 In:= Out= Generate a list of polygons in dimension 3:

 In:= In:= Out= ## Neat Examples(1)

Introduced in 2019
(12.0)