My attempt at (pseudo) Perlin Noise


This is not layered, the original creates a random wave with maxHeight 128, second gets added on top of it with maxHeight 64, third with 32,… essentially initialMaxHeight*pow(0.5,n)

however this one works by creating a random wave, but instead of stacking, it splits a segment in two, with a point between the p1 and p2 (points that define the sides).

Would this still count as Perlin Noise? Or would this count just as a “pseudo perlin wave”?

Code
ArrayList<segment> segments = new ArrayList<segment>();
int n = 10;
void setup() {
  size(1600,600);
  addSegments(n);
}
void draw() {
  background(0); stroke(255);
  for(int i = 0;i < segments.size(); i++) segments.get(i).display();
}
void mousePressed() {
  for(int i = 0, m = segments.size(); i < m; i++) {
    segments.get(i).splitSegment();
  }
}
void keyPressed() {
  if(key == ' ') {
    segments.clear();
    addSegments(n);
  }
}
void addSegments(int num) {
  float v = random(1);
  float v2 = random(1);
  float wi = width/num;
  segments.add(new segment(v,v2,0,wi));
  for(int i = 0; i < num; i++) {
    v = v2;
    v2 = random(1);
    segments.add(new segment(v,v2,(i+1)*wi,(i+2)*wi));
  }
}
class segment {
  float p1, p2;
  float x1,x2;
  segment(float p1_, float p2_, float x1_, float x2_) {
    p1 = p1_;
    p2 = p2_;
    x1 = x1_;
    x2 = x2_;
  }
  void display() {
    line(x1,(1-p1)*height,x2,(1-p2)*height);
  }
  void splitSegment() {
    float newP = map(random(1),0,1,p1,p2),newX = (x1+x2)/2;
    segments.add(new segment(newP,p2,newX,x2));
    p2 = newP;
    x2 = newX;
  }
}