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:
parent
adffa2261d
commit
022461a862
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user