X and y don't even out

i wrote a code that should, generate a random x, from 1-10 and then make a y the number that it needs to complete 10. it then should try to devide it by something it can be devided by. then it shows a visual for me to see if it lands on the middle eventually and a print to be sure. however it does not work. why?
and how do i get around it?

int x=(int(random(10-1)));
int y= 10-x;

void setup(){
   size(10,10);
   print(x);
   print(y);
 }
   
   void draw(){
      background(255,255,255);
      fill(0,0,0);
      if(x==0){x=(int(random(10-1)));}
      
      if(x>y){y=y+(int(y/3));}
      
      if(y>x){x=x+(int(x/3));}
      
      ellipse(width-x, height/2, 1,1);
      
      if(y==x){
         stop();}
      }

Hey I don’t quite get it, but I think you could do it like that too:

int x;
int y;

int target = 10;

void setup() {
  size(200, 200);

  x = int(random(1, 10));

  println("X: " + x);

  y = target-x;

  println("Y: " + y);

  x = x + y;

  println("X: " + x);

  exit();
}

i know, but it’s a proof of concept for a real world object and it would not be able to dunction that way

So you want to animate it?

Maybe like that?

float x, y, tx, ty;

float moveSpeed = 2;
//tx & ty == target

void setup() {
  size(600, 600);
  x = width/2;
  y = height/2;
}
void draw() {
  background(0);
  tx = mouseX;
  ty = mouseY;

  x = lerp(x, tx, moveSpeed / frameRate);
  y = lerp(y, ty, moveSpeed / frameRate);


  fill(255);
  ellipse(x, y, 30, 30);
}