Text random position

Hey guys, I’m new to processing. I need a text at a random Position.
But text(“Hello”,random(1,500)); isn’t allowed. How do i do that ?
Thank you in Advance

2 Likes

Hello, @Moonshiner, and welcome to the Processing Foundation Forum!

See the reference for the text() function here:

Note that it needs three arguments, the first to specify the text to be displayed, and the second and third to specify the coordinates. You have only passed one argument to the text() function, which is a call to the random() function. Instead, for what you are trying to do, two calls to the random() function are needed in the list of arguments, one for each coordinate.

4 Likes

Hi

void setup() 
{
  size(1000, 800);
  textSize(128);
  //text("HELLO", 40, 120); 
  frameRate(5);
}

void draw() 
{

  background (0, 0, 255);
  float r = random(50);
  text("HELLO", r*10, 420);
}

1 Like