# Random StrokeWeight not working?

**URL:** <https://discourse.processing.org/t/random-strokeweight-not-working/5840>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 23, 2018, 2:37am UTC](https://discourse.processing.org/t/random-strokeweight-not-working/5840 "2018-11-23T02:37:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReDeagle](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@ReDeagle](https://discourse.processing.org/u/ReDeagle)\
**Post date:** [November 23, 2018, 2:37am UTC](https://discourse.processing.org/t/random-strokeweight-not-working/5840/1 "2018-11-23T02:37:45Z")

</div>

Hey everyone, I’m making a program that will output balloons of different sizes using for loops. The fill should also be using stroke (another for loop). The program outputs balloons of the same size (code is below)… Help?

```auto
void setup()
{
  size(800,500);
  for (int i = 0;i<=800;i+=150){
  for (int random = 0; random<=100;random+=20)
      strokeWeight(random);
      point(i,100);
      strokeWeight(3);
      line(i,100,i,400);
  }
}

```

---

<div class="post-metadata">

**Author:** ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)\
**Post date:** [November 23, 2018, 2:41am UTC](https://discourse.processing.org/t/random-strokeweight-not-working/5840/2 "2018-11-23T02:41:39Z")

</div>

That will not produce a random result, as it will end up with the same result each time. You should use the `random();` function instead.

[https://processing.org/reference/random\_.html](https://processing.org/reference/random_.html)

---

<div class="post-metadata">

**Author:** ![ReDeagle](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@ReDeagle](https://discourse.processing.org/u/ReDeagle)\
**Post date:** [November 23, 2018, 2:45am UTC](https://discourse.processing.org/t/random-strokeweight-not-working/5840/3 "2018-11-23T02:45:36Z")

</div>

Thanks for the help! Works like a charm 👍
