GenerateRandomSearch

Circle Packing Generator

Circles that do not overlap, which is a promise worth checking rather than assuming: it is one distance test per pair, and every pair is tested. The interesting number is the coverage — random placement plateaus well below the 90.7% that a perfect hexagonal packing of equal circles achieves, and watching the attempt count climb as the space fills shows exactly why rejection sampling gets expensive.

What this generator does

Places circles of random radius one at a time, keeping only those that clear every circle already placed and sit fully inside the field. It reports how many fitted, how many attempts that took, the coverage and the tightest gap between any two.

How to use this tool

  1. Choose how many circles to attempt and how large they may be.
  2. Generate, and read how many actually fitted.
  3. Compare the coverage against the 90.7% theoretical maximum.
  4. Note the attempt count — it climbs steeply as the space fills.

Understanding the controls

How many circles to try
Between 5 and 200. Placement stops early when nothing more fits, so this is an upper bound rather than a target.
Largest radius
Between 3 and 15. Circles vary from 2 up to this, and larger circles fill the space faster but leave more waste.
Seed
Reproduces exactly the same arrangement, which matters if the layout is being used as artwork.

Common use cases

  • Decorative non-overlapping layouts for design work
  • Showing why random packing falls short of the theoretical limit
  • Test data for collision or layout code
  • Illustrating how rejection sampling slows as space fills
  • Reproducing the same arrangement from a seed

How this generator works

Rejection sampling: a candidate is placed only if its distance to every existing circle is at least the sum of the two radii. That makes the guarantee simple and total. The check then measures every pair independently and requires no overlap, and confirms every circle sits inside the field.

Randomness and fairness

Positions and radii are random; the no-overlap guarantee is enforced at placement and verified afterwards. Seeded packings reproduce exactly and are therefore explicitly not cryptographically secure. Unseeded, the browser's cryptographically secure generator places them.

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

Limitations and good to know

  • Rejection sampling rather than a proper packing algorithm, so the coverage is far below what careful placement achieves.
  • Circles are placed smallest-chance-first rather than largest-first, which would pack more tightly.
  • The field is a fixed square, and circles must sit entirely inside it.
  • No relaxation pass to nudge circles closer together.
  • Packings are not stored between visits.

Privacy and your data

Positions and radii are computed in your browser. Nothing is transmitted or kept.