Straight line pattern with random position

Hi there! I have made this straight line pattern that you can see in my code, looking a tutorial. Now I want to change the position of the pattern and make it random, it would be very difficult?

float x=100;
   
  void setup() {
  size(1000, 1000);
  noStroke ();
  background(128,128,128);
  
  stroke(255,255,255);
  for(float x=100;x<500;x=x+20){
  line(x,100,x,500);
  }
   
  
  }
  

no, you can add a random value to the x-value

  float a = random (-18,18); 
  line(x+a,100,
      x+a,500);
1 Like