# Print 100 Circles [closed]

Goal: Create the smallest possible code to open a separate window, in which there are 100 circles of random sizes and colors.

Rules: All circles must be visible to the unassisted, naked eye, so in other words more than 2 pixels across, the background must be black, at least 5 different colors must be recognizable, and at all circles must fit within the window.

## closed as unclear what you're asking by Rɪᴋᴇʀ, Nathan Merrill, Value Ink, Marv, NinjaBearMonkeyMay 8 '16 at 1:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• what do you mean by random sizes? what size should the window be? Can they be overlapping? Do the positions have to be random? Does it have to be filled or only have an outline? – Maltysen May 8 '16 at 0:18
• Bash, 5 bytes. feh f Must be ran in a directory containg a file named 'f' that is an image containing 100 circles of random sizes and colors, and feh must be installed. This is technically not against the rules since their aren't any. – DJMcMayhem May 8 '16 at 0:23
• I like the challange but as it stands, this is way to broad. As @DrGreenEggsandHamDJ said, you should definitely think about some limiting rules. – Marv May 8 '16 at 1:32

# Mathematica 106 bytes

The code is fairly straightforward. A palette is a floating window. The 100 circles are stored in an array. The first ryields coordinates; the second r yields a radius.

CreatePalette[{Graphics[Array[{RandomColor[],Disk[99~(r=RandomReal)~{2},r@5]}&,100],Background->Black]}]


## Java, 352 Bytes

Yeah, I know, an applet, but still...

import java.applet.*;import java.awt.*;import java.util.*;public class C extends Applet{public void paint(Graphics a){Random b=new Random();int x,y,diameter;setBackground(Color.black);for(int c=1;c<=100;c++){a.setColor(new Color(b.nextInt(0xFFFFFF)));d=b.nextInt(getWidth()/10);x1=b.nextInt(getWidth());y1=b.nextInt(getHeight());a.drawOval(x,y,d,d);}}}


Ungolfed Code:

import java.applet.*;
import java.awt.*;
import java.util.*;

public class C extends Applet {
public void paint(Graphics a) {

Random b = new Random();

int x, y, d;

setBackground(Color.black);

for (int c = 1; c <= 100; c++) {
a.setColor(new Color(b.nextInt(0xFFFFFF)));

d = b.nextInt(getWidth() / 10);
x = b.nextInt(getWidth());
y = b.nextInt(getHeight());

a.drawOval(x, y, d, d);
}

}
}

• @EᴀsᴛᴇʀʟʏIʀᴋ Nope. – Nic Hartley May 8 '16 at 0:11
• Have you tried using Math.random()*getWidth() in place of b.nextInt(getWidth())? It may save you a few bytes (you'd remove the Random b definition too) – Nic Hartley May 8 '16 at 0:14
• how about c<101 rather than c<=100 – Bald Bantha May 9 '16 at 15:39

# Python 2 PIL - 199 bytes

Making some assumptions of the rules based on OP's answer. Not optimally golfed in the sense that the image could be 5 pixels across and the circles could be all the same place with grayscale colors, but goes with the spirit of the rules.

import Image,ImageDraw,random
h=999
i=Image.new('RGB',(h,h))
g=random.randint
exec"r,x,y=g(0,50),g(0,h),g(0,h);ImageDraw.Draw(i).ellipse((x-r,y-r,x+r,y+r),(g(0,255),g(0,255),g(0,255)));"*100
i.show()