Class Humanize

java.lang.Object
com.botwithus.bot.api.util.Humanize

public final class Humanize extends Object
Human-like delay utilities to make bot behavior less detectable.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    chance(double probability)
    Returns true with the given probability.
    static long
    delay(long mean, long stdDev, long min, long max)
    Returns a gaussian-bounded delay in milliseconds, clamped to [min, max].
    static int
    loopDelay(int baseMs, double varianceFactor)
    Returns a loop delay with variance and a 5% chance of a micro-break (2-5s).
    static void
    sleep(long mean, long stdDev)
    Sleeps for a gaussian-distributed duration.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 delay
      stdDev - the standard deviation
      min - minimum allowed delay
      max - 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 milliseconds
      stdDev - 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 milliseconds
      varianceFactor - multiplier for the variance (e.g., 0.3 = 30% of base)
      Returns:
      the computed delay in milliseconds
    • chance

      public static boolean chance(double probability)
      Returns true with the given probability.
      Parameters:
      probability - a value between 0.0 (never) and 1.0 (always)
      Returns:
      true if the random check passed