Can someone explain noise() aka perlinNoise() function?

You’re using the function correctly but at the “wrong scale”.

Scale down the noise inputs (so that the noise difference between successive pixels is lesser; i.e. the frequency is reduced) and you’ll get a more expected result:

final float scale = 0.01;

void draw() {
  for(int i = 0; i < width; i++) {
    for(int j = 0; j < height; j++) {
      stroke(noise(i*scale,j*scale)*255);
      point(i,j);
    }
  }
  noLoop();
}

Note that noiseDetail() doesn’t affect the “zoom” or the pattern at a coarse level, but affects the finer detail of the noise pattern – higher values for noiseDetail are more important the more “zoomed in” the noise is.

scaled inputs, with noiseDetail = 4 (default):

scaled inputs, with noiseDetail = 8:

However, back to your original image, the zoomed out view shows us that Processing’s noise function is terrible at large scales – we can clearly see it’s not randomly noisy (in the manner we would like) at all! (Why is perlin noise looping? - #4 by jeremydouglass)