1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-16 20:28:15 +01:00

AbstractRipper.java - fix gaussian jitter on sleep values

This commit is contained in:
MetaPrime 2025-01-06 02:31:52 -08:00
parent adffa2261d
commit 022461a862

View File

@ -723,18 +723,19 @@ public abstract class AbstractRipper
private int gaussianJitterSleepValue(int milliseconds) { private int gaussianJitterSleepValue(int milliseconds) {
LOGGER.debug("Requested sleep time: " + milliseconds); LOGGER.debug("Requested sleep time: " + milliseconds);
double gauss = randomGenerator.nextGaussian(); String requestedMsg = " (Requested sleep time was " + milliseconds + " ms)";
int sleepTime = (int) (milliseconds + (milliseconds * 0.3 * gauss));
LOGGER.debug( int sleepTime = (int) randomGenerator.nextGaussian(milliseconds, milliseconds * 0.3);
"Sleep time after gaussian jitter: " + sleepTime + "(requested sleep time was " + milliseconds + ")"); LOGGER.debug("Sleep time after gaussian jitter: " + sleepTime + requestedMsg);
int minSleepTime = (int) (milliseconds * 0.47); int minSleepTime = (int) (milliseconds * 0.47);
LOGGER.debug("Minimum allowable sleep time after gaussian jitter: " + sleepTime + "(requested sleep time was " LOGGER.debug("Minimum allowable sleep time after gaussian jitter: " + sleepTime + requestedMsg);
+ milliseconds + ")");
if (sleepTime < minSleepTime) { if (sleepTime < minSleepTime) {
LOGGER.debug("Sleep time after gaussian jitter on " + milliseconds + " was " + sleepTime LOGGER.debug("Sleep time after gaussian jitter on " + milliseconds + " was " + sleepTime
+ " which is less than minimum sleep time; adjusting to minimum sleep time of " + minSleepTime); + " which is less than minimum sleep time; adjusting to minimum sleep time of " + minSleepTime
+ requestedMsg);
sleepTime = minSleepTime; sleepTime = minSleepTime;
} }