# What is the xRed position?

**URL:** <https://discourse.processing.org/t/what-is-the-xred-position/24527>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [October 11, 2020, 11:27pm UTC](https://discourse.processing.org/t/what-is-the-xred-position/24527 "2020-10-11T23:27:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thughes](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@thughes](https://discourse.processing.org/u/thughes)\
**Post date:** [October 11, 2020, 11:27pm UTC](https://discourse.processing.org/t/what-is-the-xred-position/24527/1 "2020-10-11T23:27:43Z")

</div>

I’m a little confused on the xRed position?!?!

| xRed and yRed position for the RED ball . Remember this should be set to x anywhere and y will be a random between 200 and 400. The ball will be width and height of 30 |
| --- |
| xBlue and yBlue position for the blue ball. Set this to 0, 0 and width and height of 30. |

```auto
int xRed=int (random());
int yRed=int (random(200, 400));
int xBlue=0;
int yBlue=0;

```

---

<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:** [October 11, 2020, 11:44pm UTC](https://discourse.processing.org/t/what-is-the-xred-position/24527/2 "2020-10-11T23:44:09Z")

</div>

> [@thughes](#):
>
> I’m a little confused on the xRed position?!?!

What is your interpretation of what the _xRed_ position is? And where _anywhere_ is?

The Processing website is here:

_[https://processing.org/](https://processing.org/)_

It has references, tutorials and examples.

I suggest that you:

- Read the _Coordinate System and Shapes_ tutorial.
- Find the reference to random() and a reference for the shape that you want to use for the RED ball.

`:)`

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [October 12, 2020, 7:32am UTC](https://discourse.processing.org/t/what-is-the-xred-position/24527/3 "2020-10-12T07:32:32Z")

</div>

xRed is the x component of the red ball, and as per your brief is allowed any value, while yRed is the y component of the red ball and can only take values between 200 and 400.

---

<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:** [October 12, 2020, 12:34pm UTC](https://discourse.processing.org/t/what-is-the-xred-position/24527/5 "2020-10-12T12:34:22Z")

</div>

Please read the reference about random to see how to define xRed
