Here's a method I use to click a random coordinate in a shape with normal distribution:
public boolean clickRandomXY(Shape region)
{
Rectangle r = region.getBounds();
int maxX = (int) r.getMaxX() - 1;
int maxY = (int) r.getMaxY() - 1;
int minX = (int) r.getMinX() + 1;
int minY = (int) r.getMinY() + 1;
int x, y;
do
{
x = rand(minX, maxX);
y = rand(minY, maxY);
} while (!(x <= maxX) || !(x >= minX) || !(y <= maxY) || !(y >= minY));
return !mouse.click(x, y, false);
}
I know the code is a bit ugly, I apologize. rand() is my method for a random integer with normal distribution.
Using this method, the mouse will move to the coordinates and then just not click sometimes.
I also find it odd that click() returns true if the event failed... what's the reason for that? It goes against logic.