void setup() { size(800, 800); background(0); } void draw() { float x, y; int numSides; float dist; x = random(width); y = random(height); numSides = 6; dist = 100; polygon(x, y, numSides, dist); frameRate(1); } void polygon(float x, float y, int numSides, float dist) { float angle1, angle2; float delta; stroke(255, 0, 0); strokeWeight(4); delta = 2*PI/numSides; // 2*PI radians in a circle for (int i=0; i