To the right is an image I created from a very simple simulation of a "random walk" along the y-axis as time moved along the x-axis. Many have noted the similarity between this process and the peaks and valleys of markets, mountain ranges, and other stochastic processes. If you haven't already, give it a try.
Source for Random Walk:
int x, y, r, middle, randOffset, previousX, previousY; void setup() { size(900, 900); stroke(0); background(192, 64, 0); x = 0; r = 2; y = 200; } void draw() { previousX = x; previousY = y; x++; // y does random up or down of 10 units randOffset = 10 - (int)random(21); y = y + randOffset; //line(150, 25, mouseX, mouseY); stroke(0); line(previousX, previousY, x, y); if(x < 800) save("random_walk.tif"); }
No comments:
Post a Comment