# Multiple help beginner completely new

**URL:** https://discourse.processing.org/t/multiple-help-beginner-completely-new/15153
**Category:** Coding Questions
**Created:** [November 2, 2019, 4:25pm UTC](https://discourse.processing.org/t/multiple-help-beginner-completely-new/15153 "2019-11-02T16:25:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![FilDomInteractive](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fildominteractive/32/6678_2.png) [@FilDomInteractive](https://discourse.processing.org/u/FilDomInteractive)
#### Post date: [November 2, 2019, 4:25pm UTC](https://discourse.processing.org/t/multiple-help-beginner-completely-new/15153/1 "2019-11-02T16:25:26Z")

</div>

please help me, I am making a project and I want a rectangle be at a random position but will stay here until the game closes, not that it will still generate everywhere. help.  
I will insert the code I need to fix. Thank you.

```auto
int px, py;
float len;
int value = 0;

void setup(){
  size(800, 600);
  cursor(CROSS);
  len = max(width + 12121, height + 12121);
  px = 255;
  py = 199;
  stroke(0);
  strokeWeight(2.7);
}

void draw(){
  background(255);
  drawLine(px, py, mouseX, mouseY);
  fill(0);
  stroke(2.77);
  fill(255);
  ellipse(px, py, 20, 20);
  rect(random(800), random(600), 30, 70);
  
  if(px > width - 10) {
    px = width - 10;
  }
  if(px < 10) {
    px = 10;
  }
  if(py > height - 10) {
    py = height - 10;
  }
  if(py < 10) {
    py = 10;
  }
}

void drawLine(float fx, float fy, float tX, float tY){
  float ang = atan2(tY - fy, tX - fx);
  float x = fx + cos(ang) * len;
  float y = fy + sin(ang) * len;
  stroke(255,0,0);
  strokeWeight(3);
  line(fx, fy, x, y);
}

void keyPressed() {
  if(keyPressed == true && key == 'd' || key == 'D') {
    px = px + 4;
  }
    if(keyPressed == true && key == 'a' || key == 'A') {
    px = px - 4;
  }
    if(keyPressed == true && key == 's' || key == 'S') {
    py = py + 4;
  }
    if(keyPressed == true && key == 'w' || key == 'W') {
    py = py - 4;
  }
}

```

---

<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: [November 2, 2019, 4:44pm UTC](https://discourse.processing.org/t/multiple-help-beginner-completely-new/15153/2 "2019-11-02T16:44:43Z")

</div>

> [@FilDomInteractive](#):
>
> rect(random(800), random(600), 30, 70);

that’s the problem.

Please make a variable rx, ry and use them here instead of random.

Set both values to random values in setup ()
