# I want to create random circle walking how would I do this?

**URL:** <https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937>\
**Category:** Beginners\
**Created:** [July 12, 2022, 7:32pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937 "2022-07-12T19:32:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anche-jpg](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anche-jpg](https://discourse.processing.org/u/anche-jpg)\
**Post date:** [July 12, 2022, 7:32pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/1 "2022-07-12T19:32:30Z")

</div>

Hello Processing People,

I am having some trouble doing a basic thing. I would like to have circle walking like [this](https://openprocessing.org/sketch/456934) on screen. If you look at the link, he has written code for the art which I am using but it is somehow incorrect in Processing. I am struggling with the output of this code. All I get is a circle once I run the code. Could you guys please help me figure out what I’m doing wrong.

```auto
float x = 200;
float y = 200;
float s = 50;
float m = 5;

void setup(){
  size(700,700);
  background(255,255,255);
  
}

void draw(){
  ellipse(50,50,75,75);
  
  x = x + random(350);
  y = y + random(350);
  
}  

```

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [July 12, 2022, 7:39pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/2 "2022-07-12T19:39:21Z")

</div>

Hello,

You wrote in draw:

```auto
ellipse(50,50,75,75);

```

So it keeps drawing an ellipse at coordinates (50, 50).  
You want to use your x and y variables for it to move around.

---

<div class="post-metadata">

**Author:** ![anche-jpg](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anche-jpg](https://discourse.processing.org/u/anche-jpg)\
**Post date:** [July 12, 2022, 7:43pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/3 "2022-07-12T19:43:27Z")

</div>

Thank you 🙈 really basic but makes more sense. Can I use frame rate to speed up the circles?

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [July 12, 2022, 7:48pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/4 "2022-07-12T19:48:38Z")

</div>

Hi

Random path or random path and size ??

```auto

float x = 200;
float y = 200;
float s = 50;
float m = 5;

void setup(){
  size(700,700);
  background(255,255,255);
   frameRate(4);
}

void draw(){
 background (0);
  ellipse(1+y,1+x,75,75);
  
  x = x + random(35);
  y = y + random(35);
  
}

```

---

<div class="post-metadata">

**Author:** ![anche-jpg](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anche-jpg](https://discourse.processing.org/u/anche-jpg)\
**Post date:** [July 12, 2022, 7:49pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/5 "2022-07-12T19:49:28Z")

</div>

Thank you, just random path please if this is it I appreciate it.

---

<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 12, 2022, 8:19pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/6 "2022-07-12T20:19:35Z")

</div>

> [@jafal](#):
>
> `frameRate(4);`

Try 400 here instead of 4

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [July 12, 2022, 8:51pm UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/7 "2022-07-12T20:51:32Z")

</div>

> [@Chrisir](#):
>
> Try 400 here instead of 4

Yes increasing frame rate increase the speed but I used it to show him how it’s moving randomly in slow speed  
Using this value

```auto
x = x + random(350);
  y = y + random(350);

```

Making the path too fast at normal frame rate

Thanks for your attention

---

<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 13, 2022, 6:51am UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/8 "2022-07-13T06:51:51Z")

</div>

We also need negative values for random!!

So random (-35,35)

(Which makes it possible that 0 occurs or very small values. There is a workaround with random 3,35 and then use a 2nd random to make that negative in 50 % of the cases. But here it’s okay to have 0 values)

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 13, 2022, 10:28am UTC](https://discourse.processing.org/t/i-want-to-create-random-circle-walking-how-would-i-do-this/37937/9 "2022-07-13T10:28:28Z")

</div>

Hello @anche-jpg,

Take a look at the source code again and compare it to your version.

There are resources (tutorials, references, examples, etc.) here:  
[https://processing.org/](https://processing.org/)

For starters:  
[https://processing.org/reference/random\_.html](https://processing.org/reference/random_.html)  
[https://processing.org/reference/ellipse\_.html](https://processing.org/reference/ellipse_.html)  
[https://processing.org/reference/circle\_.html](https://processing.org/reference/circle_.html)

Also look at references for `setup()`, `size()` and `draw()`.

Also a good resource:  
[https://happycoding.io/](https://happycoding.io/) \< There is an example in there that may be of interest.

Once you understand this code take a step back and start with a blank sketch and write your code [from scratch](https://dictionary.cambridge.org/dictionary/english/from-scratch). This will help develop your programming skills and this is a nice simple example to start with.

`:)`
