Documentation
    Preparing search index...
    • Generates a random string containing only lowercase alphabetical characters.

      Creates a string of specified length using only characters a-z. Each character is independently randomly selected, so the same character may appear multiple times. Useful for generating random identifiers, test names, or placeholder text.

      Processing cost: Constructing L characters costs O(L) time and intermediate/result space.

      Parameters

      • length: number

        The desired length of the generated alphabetic string

      Returns string

      A string containing only lowercase letters of the specified length

      RandomGenerator.alphabets(5); // e.g. "kxqpw"
      RandomGenerator.alphabets(3); // e.g. "mzr"
      RandomGenerator.alphabets(10); // e.g. "qwertasdfg"

      // Generate random CSS class names
      const className = `test-${RandomGenerator.alphabets(6)}`;

      // Create random variable names for testing
      const varName = RandomGenerator.alphabets(8);

      contracts/common.md#principled-implementation Each requested character maps a Math.random draw to one of 26 lowercase letters. Repeats are possible, and distribution inherits Math.random rather than guaranteeing exact uniformity.

      contracts/common.md#clear-and-simple-design One expression over the shared integer helper.

      contracts/common.md#prohibited-implementation-shortcuts The characters are drawn, not enumerated from a list of known values.

      contracts/common.md#meaningful-documentation The comment states the character set, the independence of the draws, and examples.