# Plotting random circles in a square

How can we draw 20 circles which have random radius in a specified range, with random positions. All centers must be in a square with side=10 (for example centimeter):

every overlapping between any circles (their circumference) can happen is it possible to color the circumstances with random colors?!

• This doesn't sound as a question that is particularly aimed at Mathematica; it's more algorithmic of nature and one could develop solutions using brain, pen and paper. Could you indicate what the specific Mathematica angle is here and what you have done so far? – Sjoerd C. de Vries Jun 2 '15 at 13:07
• Ok, I am editing that. – Unbelievable Jun 2 '15 at 13:21
• at the first I produced a table contained 20 random numbers (as centers) in a range and 20 others (as radius) and plotted (pairs) of them. But I am going to obtain a short way to that. – Unbelievable Jun 2 '15 at 13:26
• I see that you changed your question so it doesn't include non-intersecting circles, but I wanted to point out this tangentially related question nonetheless: Generating visually pleasing circle packs. It would be worth a look for the sheer artistic value alone. – MarcoB Jun 2 '15 at 15:44

centers = RandomReal[{0, 10}, {20, 2}];
FaceForm[Transparent], EdgeForm[Red],
Polygon[{{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}}]}]


Edit

If you want disjoint circles you may go with something like:

SeedRandom[42];
f := {RandomReal[{0, 10}, 2], RandomReal[{0, 1}]}
l = {f};
While[
Length@l < 100,
While[k = f;
Not[And @@ ((# + k)[[2]] < EuclideanDistance[#[[1]], k[[1]]] & /@ l)]];
AppendTo[l, k]];
Graphics[{Circle @@@ l, FaceForm[Transparent], EdgeForm[Red],
Polygon[{{0, 0}, {0, 10}, {10, 10}, {10, 0}, {0, 0}}]}]


• Hmm… is Rectangle[] not affected by FaceForm[]? – J. M. will be back soon Jun 2 '15 at 14:05
• @J. M. I believe it is. Why? – Dr. belisarius Jun 2 '15 at 14:07
• Ah, I thought it was the reason why you used Polygon[] instead… – J. M. will be back soon Jun 2 '15 at 14:10
• @J. M. Nah, I want a cute expression for the vertex ordering, and still working on that. – Dr. belisarius Jun 2 '15 at 14:12
• can the circles be colored (off course random colored) I mean their circumstances be colored!?? – Unbelievable Jun 2 '15 at 16:49