 # Week 4 Tut­o­r­i­a­l

• Show Sketch
``````/** @peep sketchcode */
//Exercise i - Use three variables assigned to random values to create a composition that is different every time the program is run.
size(400, 400);
background(52, 57, 98);
smooth();
strokeWeight(20);
stroke(0, 130);
rect(0, random(height), width, random(height));
rect(0, random(height), width, random(height));
rect(0, random(height), width, random(height));
rect(0, random(height), width, random(height));
rect(0, random(height), width, random(height));``````

a few years ago
• Show Sketch
``````/** @peep sketchcode */
// Exercise ii - Create a composition using a for structure and random() to make a different dense composition every time the program is run.
size(200, 200);
background(80, 98, 209);
fill(255,60);
noStroke();
rectMode(CENTER);
for (int x = 20; x < width; x += 20) {
for (int y = 20; y < height; y += 20) {
float r = random(100, 40);
rect(x, y, r, r);
}
}``````
Last Updated: 23-Mar-2016 3:30 PM
a few years ago
• Show Sketch
``````/** @peep sketchcode */
size(200, 200);
background(0);
fill(255, 60);
noStroke();
ellipseMode(CENTER);
for (int a = 20; a < 10; a += 20) {
for (int b = 20; b < 10; b += 20) {
for (int c = 20; c < width; c += 20) {
for (int d = 20; d < height; d += 20) {
float w = random(100, 40);
float x = random(100, 40);
float y = random(100, 40);
float z = random(100, 40);
ellipse(w, x, c, d);
}
}
}
}``````