# Straight line pattern with random position

**URL:** <https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075>\
**Category:** Coding Questions\
**Created:** [July 5, 2021, 5:50pm UTC](https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075 "2021-07-05T17:50:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)\
**Post date:** [July 5, 2021, 5:50pm UTC](https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075/1 "2021-07-05T17:50:50Z")

</div>

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?

```auto
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);
  }
   
  
  }
  

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [July 5, 2021, 6:06pm UTC](https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075/2 "2021-07-05T18:06:02Z")

</div>

> [@humano](#):
>
> ` line(x,100,x,500);`

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

```auto
  float a = random (-18,18); 
  line(x+a,100,
      x+a,500);

```
