Hello @humano ,
Please format your code:
https://discourse.processing.org/faq#format-your-code
Please link to the original work if that is your starting point.
I did find the original work and it does credit the authors and the code works.
You may have a copy of a copy that does not work.
This is not the best example and could be simplified further for better understanding.
This is an exercise that is achievable and worth trying on your own.
Simple example (incomplete):
int startX = 0;
int startY = 0;
int endX = 0;
int endY = 0;
int firstX = 100; // Can be used later to close the lines.
int firstY = 100;
// Setup() runs once! See reference.
void setup()
{
size(400, 400);
background(255);
int startX = firstX;
int startY = firstY;
frameRate(1); //Slows things down for testing! See reference.
}
// Draw() loop. See reference.
void draw()
{
strokeWeight(2);
stroke(0);
println("Start points:", endX, endY);
// Set random endpoints here:
// Add your code here...
println("End points:", endX, endY);
println();
line(startX, startY, endX, endY);
// Set start point x,y to end x, y for start of draw() cycle here:
// Add your code here...
//println("Start points:", endX, endY); //Moved to start since it loops around
}
Start simple, understand each element of the code and build on that… :)
There are lots of resources (tutorials, references, examples, etc.) here:
processing.org
Check out the examples that come with Processing.
These are in the menu under File > Examples…> :

:)