Files
processing4/java/examples/Basics/Math/DoubleRandom/DoubleRandom.pde
benfry eb64b2d4fc
2011-01-26 19:22:19 +00:00

21 lines
384 B
Plaintext

/**
* Double Random
* by Ira Greenberg.
*
* Using two random() calls and the point() function
* to create an irregular sawtooth line.
*/
size(200, 200);
background(0);
int totalPts = 300;
float steps = totalPts + 1;
stroke(255);
float rand = 0;
for (int i = 1; i < steps; i++){
point( (width/steps) * i, (height/2) + random(-rand, rand) );
rand += random(-5, 5);
}