# Random starting Angle to finish Circle

**URL:** https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694
**Category:** Coding Questions
**Created:** [April 28, 2021, 6:13am UTC](https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694 "2021-04-28T06:13:35Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![javagar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/javagar/32/11434_2.png) [@javagar](https://discourse.processing.org/u/javagar)
#### Post date: [April 28, 2021, 9:41am UTC](https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694/4 "2021-04-28T09:41:04Z")

</div>

The condition `a < TWO_PI + a` will of course always evaluate to `true`.

Why not first choose a random starting angle, like this?:

```auto
  float start_angle = random(0, TWO_PI);

```

With that, you can write the program as follows:

```auto
void setup() {
  size(400, 400);
}
void draw() {
  translate(width/2, height/2);
  noFill();
  beginShape();
  float r = 100;
  float start_angle = random(0, TWO_PI);
  for (float a = 0; a < TWO_PI; a += 0.02) {
     float x = r * cos(a + start_angle);
     float y = r * sin(a + start_angle);
     vertex(x, y);
    }
  endShape();
}

```

---

_[View the full topic](https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694)._
