Simple Perlin Noise



//Perlin noise produces a more organic looking random number sequence

float time, x;

void setup() {
  size(400, 400);
  background(255);
  stroke(0);
  strokeWeight(3);
  time = 0;
  x = 0;
}

void draw() {
  //the noise function takes a value and returns a number between 0 and 1
  float num = noise(time); 
  
  //the map function re-maps a number from one range to a new range
  float y = map(num, 0, 1, 0, height);
  point(x,y);
  
  //increment the value going into the noise function
  //the smaller the increment, the smoother the noise sequence will be
  time+=0.01;
  x += 1;
}

void mouseClicked(){
  background(255);
  x = 0;
}
Download source.