noise()

noise
noise() \ Language (API) \ Processing 2+

returns the perlin noise value at specified coodinates
Perlin noise is a type of gradient noise

float noiseScale = 0.02;

void draw(){
  background(0);
  
  for (int x=0; x<width; x++){
    
    float noiseValue = noise((mouseX+x)*noiseScale,mouseY*noiseScale);
    
    stroke(noiseValue*255);
    
    line(x,mouseY+noiseValue*80,x,height);
  }
}
float xoff = 0.0;

void draw(){
  background(204);
  
  xoff = xoff + 0.05;
  
  float n = noise(xoff)*width;
  line(n,0,n,height);
}