GenerateRandomSearch

Voronoi Diagram Generator

Put a few sites on a plane and colour every location by whichever site is nearest: that colouring is the Voronoi diagram, and it turns up wherever proximity decides ownership — catchment areas, mobile cells, nearest-depot delivery. This computes it by sampling rather than by constructing edges, which makes the definition and the drawing the same thing, and makes the check trivially honest: measure the sampled cell against every site.

What this generator does

Places sites at random and labels every cell of a sampling grid with its nearest site. The resulting picture is the diagram, and the count of cells per site gives each region's share of the area.

How to use this tool

  1. Choose how many sites to place.
  2. Predict roughly where the boundaries will fall.
  3. Generate, and compare against the regions drawn.
  4. Read each region's share of the total area.

Understanding the controls

How many sites
Between 4 and 12 regions. More sites make each region smaller and the picture busier.
Seed
Reproduces the same sites and therefore the same regions.

Common use cases

  • Territory and catchment-area illustrations
  • Showing that a boundary is always the perpendicular bisector of two sites
  • Test data for nearest-neighbour queries
  • Procedural map regions for a game or a diagram
  • Reproducing the same site layout from a seed

How this generator works

Each grid cell's centre is measured against every site and assigned to the closest. That is the definition of the diagram rather than an approximation of an algorithm for it. The check re-measures a sample of cells against every site and requires no site to be closer than the one assigned.

Randomness and fairness

The site positions are random; the regions follow from them exactly. Seeded diagrams reproduce and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.

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

Limitations and good to know

  • Regions are drawn by sampling a grid, so the boundaries are stepped rather than exact lines.
  • Region shares are measured from the same sampling, so they carry the same small error.
  • Euclidean distance only — Manhattan Voronoi diagrams look quite different.
  • Two dimensions, and a square field with no wraparound.
  • Diagrams are not stored between visits.

Privacy and your data

Sites and regions are computed in your browser. Nothing about the diagram or your seed leaves the page.