Documentation
    Preparing search index...
    • Extracts a random substring from the provided content string.

      Selects two random positions within the content and returns the substring between them. The starting position is always before the ending position. Automatically trims whitespace from the beginning and end of the result. Useful for creating excerpts, search terms, or partial content samples.

      Parameters

      • content: string

        The source string to extract a substring from

      Returns string

      A trimmed substring of the original content

        const text = "The quick brown fox jumps over the lazy dog";

      RandomGenerator.substring(text); // e.g. "quick brown fox"
      RandomGenerator.substring(text); // e.g. "jumps over"
      RandomGenerator.substring(text); // e.g. "fox jumps over the lazy"

      // Generate search terms from content
      const searchQuery = RandomGenerator.substring(articleContent);

      // Create excerpts for previews
      const excerpt = RandomGenerator.substring(fullBlogPost);

      // Generate partial matches for testing search functionality
      const partialMatch = RandomGenerator.substring(productDescription);

      // Create random selections for highlight testing
      const selectedText = RandomGenerator.substring(documentContent);