I'm making a program that infinitely clicks on a certain spot. I made those clicks to be random, using the following code:
public void leftClick() {
int no = random.nextInt(5) + 1;
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(50 * no);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.delay(250 * no);
}
And here's the loop in which the leftClick() method is used (integer o is initialized above in the program):
while (running) {
leftClick();
o++;
System.out.println(new Date() + " " + o);
}
When implemented in my program, this 'clicking' goes on and on, with random pauses between each click. I tested it, and it results in about 35-45 clicks per minute. Is there a way to make my program click for example, 35 times in one minute, and then 70-80 in the next?