Organic Random Lines

Hi there! I am trying to draw organic lines, so I have started making that kind of oscillations that you can see on black line. I don’t know if that can be done easier, but is was the only possible way for my beguinner level. The problem is this, that way does not work when I try to draw a random line, the red one. Do you know how can I draw more natural lines in other way? Thank you so much!

void setup() {
  size(1000, 1000);
  background(255,255,255);
  smooth(10);
  
  
  stroke(0);
  strokeWeight(9);  
  line(100,500,222,490);
  line(222,490,310,505);
  line(310,505,330,495);
  line(330,495,340,505);
  line(340,505,400,490);
  line(400,490,520,510);
  line(520,510,540,495);
  line(540,495,550,490);
  line(550,490,680,500);
  line(680,500,800,505);
  line(800,505,900,500);
  
  
  stroke(255,0,0);
  strokeWeight(9);
  float x1 = random(0,1000);
  float y1 = random(0,1000);
  float x2 = random(0,1000);
  float y2 = random(0,1000);
  
  line(x1,y1,x2,y2);
  
  
  
  }
   

Hello,

Take a look here:

https://processing.org/reference/noise_.html

https://processing.org/examples/noisewave.html[https://processing.org/examples/noisewave.html](https://processing.org/examples/noisewave.html)

YouTube I.5: Perlin Noise - The Nature of Code

:)

I have tried with noise as you have told me, but I don’t understand nothing at all. Maybe I have to start with easier questions. I have tried yo make a line between 2 random points, introducing one between them with a variation. I can repeat that sometimes to make more organic lines. I Will work on this and I Will Come back here to try noise function again later.

void setup() {
  size(600, 600);
  background(255,255,255);
  strokeWeight(10);
  
  float x1 = random(0, 600);
  float y1 = random(0, 600);
  float x2 = random(0, 600);
  float y2 = random(0, 600);
  float a = random(x1,x2);
  float b = random(y1,y1);
  
  
  
  beginShape();
  vertex(x1,y1);
  vertex(a,b);
  vertex(x2,y2);
  endShape();
  }