Focus can play a very important factor in your script; it could be the difference between a ban or not. As a result, I have found a way to simulate the idea of focus.
Take this graph as an example:
This graph shows the distributions of 3 response profiles: focused (in red), playing normally (in orange), and unfocused (in blue)
Please note that this graph is not based on any statistical evidence.
If you are focused (for example you're being PK'd), you are more likely to click faster and respond faster. If you are playing the game normally, you will click at an average-ish time. If you aren't focused (for example watching TV), you are more likely to click slower.
This graph shows that the graph for being focused is a positive distribution. This means that the majority of the data will be clustered towards the negative end (closer to 0) than the positive end. It also shows that not being focused has a negative distribution, which means that the majority of the data is clustered towards the positive end (closer to 100 or wherever the graph ends) than 0. Playing normally has a normal distribution, which means that the data clusters around the midpoint of the data (in this scenario it would likely be symmetrical too, meaning that mean = mode = median)
Below is some code that I found on Stackoverflow and slightly modified it.
public int positiveSkewedRandom(int min, int max) {
return skewedRandom((double) min, (double) max, 2.55, -1.68);
}
public int negativeSkewedRandom(int min, int max) {
return skewedRandom((double) min, (double) max, 2.55, 1.68);
}
public int skewedRandom(double min, double max, double skew, double bias) {
Random r = new Random(System.currentTimeMillis());
double range = max - min;
double mid = min + range / 2.0;
double unitGaussian = r.nextGaussian();
double biasFactor = Math.exp(bias);
double retval = mid + (range * (biasFactor / (biasFactor + Math.exp(-unitGaussian / skew)) - 0.5));
return (int) retval;
}
The params for skewedRandom:
min - the minimum possible value
max - the maximum possible value
skew - how close the data would be clustered together (higher = tighter clustering)
bias - the tendency for the mode to approach the min/max/midpoint of the data; negative = positive bias, positive = negative bias
Usage:
boolean focused = true;
if (focused) {
sleep(positiveSkewedRandom(100, 750));
}
else {
sleep(negativeSkewedRandom(100, 750));
}
If the data is not skewed enough, you can change the skew and bias settings in the respective method.
Good luck, and happy botting!