TS-Scribe - v0.6.2
    Preparing search index...

    Function randomString

    • Generates a random string of the specified length, with options to include numbers and symbols.

      Parameters

      • length: number

        The length of the generated string.

      • Optionalconfig: { includeNumbers: boolean; includeSymbols: boolean }

        Configuration options for the string generation.

        • includeNumbers: boolean

          Whether to include numeric characters (0–9). Defaults to false.

        • includeSymbols: boolean

          Whether to include symbol characters (e.g., !@#$...). Defaults to false.

      Returns string

      A randomly generated string containing uppercase and lowercase letters, and optionally numbers and symbols.

      randomString(10);                             // e.g., "aZkLpCmhN"
      randomString(5, { includeNumbers: true }); // e.g., "aB1c9"
      randomString(8, { includeNumbers: true, includeSymbols: true }); // e.g., "aB3!Lp9&"
      randomString(12, { includeNumbers: false, includeSymbols: false }); // e.g., "aBcDeFgHiJkL"