captcha-canvas API Documentation - v3.3.4
    Preparing search index...

    Function getRandom

    • Generates a random integer within the specified range (inclusive).

      This function provides cryptographically secure random number generation for use in CAPTCHA positioning, rotation angles, and other randomization needs.

      Parameters

      • start: number = 0

        Minimum value (inclusive)

      • end: number = 0

        Maximum value (inclusive)

      Returns number

      Random integer between start and end

      const angle = getRandom(-15, 15); // Random angle between -15 and 15 degrees
      
      const index = getRandom(5); // Random number from 0 to 5