float xPos, randomer;

void setup()
{
size(600,600);
xPos = width/2;
randomer=0;
}

void draw()
{
background(255);
fill(0);
text("Amount: "+randomer, mouseX+15, mouseY+5);
xPos = mouseX;
float randomX = random(xPos-randomer,xPos+randomer);
// line(xPos,0,xPos,height);
line(randomX,0,randomX,height);
}

void keyPressed()
{
if(key=='.')
{
randomer++;
}
else if(key==',' && randomer > 0)
{
randomer--;
}
}