Perlin noise range does not go all the way from 0.0 - 1.0

I realize that the noise() function won’t go all the way to 1.0, but I’d think that it would at least get as high as 0.999, but it only reaches around 0.846, and it only goes down to about 0.0735. That means when I’m plotting random x,y values based on noise(), the x and y never reaches the edges.
In my example below, the plot never reaches the edges. It clumps around the center, which is what I expect and actually want, but I get nothing on the edge. Right now I fix the problem with map(noise(time),0.1,0.8,0,width-1) and constrain the result between 0 and width-1 for the few times it runs outside that range.
Is there a better way to handle this? Is noise() bugged or is this expected with Perlin noise?
.

float minNoiseX = 1;
float maxNoiseX = 0;
float minNoiseY = 1;
float maxNoiseY = 0;
float noiseX, noiseY;

void setup() {
  size(800,800);
  background(255);
}

void draw() {
  stroke(0);
  for(int i = 0; i < 1000; i++) {
    noiseX = noise(random(1000));
    noiseY = noise(random(1000));
    if(noiseX < minNoiseX) minNoiseX = noiseX;
    if(noiseX > maxNoiseX) maxNoiseX = noiseX;
    if(noiseY < minNoiseY) minNoiseY = noiseY;
    if(noiseY > maxNoiseY) maxNoiseY = noiseY;
    point(noiseX*width,noiseY*height);
  }
}

void mouseClicked() {
  println("minNoiseX = "+str(minNoiseX)+" : minNoiseY = "+str(minNoiseY));
  println("maxNoiseX = "+str(maxNoiseX)+" : maxNoiseY = "+str(maxNoiseY));
}

Random function

  • provides a random number in the range 0≤ n <1 and
  • random numbers are evenly distributed over this range
    This means that the chance of getting 0.001, 0.5 or 0.9999 are all equally likely.

Noise function

  • provides a number in the range 0≤ n <1
  • numbers are related to previous value obtained
  • numbers are close + or - to the previous value obtained
    This means to get a value close to 1 is extremely rare because it requires the numbers to get bigger much more often than get smaller.

So the answer is Yes :grin:

1 Like