Class Humanize
java.lang.Object
com.botwithus.bot.api.util.Humanize
Human-like delay utilities to make bot behavior less detectable.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanchance(double probability) Returnstruewith the given probability.static longdelay(long mean, long stdDev, long min, long max) Returns a gaussian-bounded delay in milliseconds, clamped to [min,max].static intloopDelay(int baseMs, double varianceFactor) Returns a loop delay with variance and a 5% chance of a micro-break (2-5s).static voidsleep(long mean, long stdDev) Sleeps for a gaussian-distributed duration.
-
Method Details
-
delay
public static long delay(long mean, long stdDev, long min, long max) Returns a gaussian-bounded delay in milliseconds, clamped to [min,max].- Parameters:
mean- the mean delaystdDev- the standard deviationmin- minimum allowed delaymax- maximum allowed delay- Returns:
- a randomized delay in milliseconds
-
sleep
public static void sleep(long mean, long stdDev) Sleeps for a gaussian-distributed duration.- Parameters:
mean- the mean sleep time in millisecondsstdDev- the standard deviation in milliseconds
-
loopDelay
public static int loopDelay(int baseMs, double varianceFactor) Returns a loop delay with variance and a 5% chance of a micro-break (2-5s).- Parameters:
baseMs- the base delay in millisecondsvarianceFactor- multiplier for the variance (e.g., 0.3 = 30% of base)- Returns:
- the computed delay in milliseconds
-
chance
public static boolean chance(double probability) Returnstruewith the given probability.- Parameters:
probability- a value between 0.0 (never) and 1.0 (always)- Returns:
trueif the random check passed
-