Generates a random paragraph with configurable sentence structure.

Creates a paragraph consisting of a specified number of "sentences" (words). Each sentence is a random alphabetic string, and sentences are joined with spaces. Returns a currying function to allow configuration of word length ranges.

  // Generate with default word lengths (3-7 characters)
RandomGenerator.paragraph(3)(); // "hello world test"
RandomGenerator.paragraph(5)(); // "lorem ipsum dolor sit amet"

// Custom word length ranges
RandomGenerator.paragraph(4)(2, 5); // "ab cd ef gh"
RandomGenerator.paragraph(6)(8, 12); // "verylongword anotherlongword..."

// Generate product descriptions
const description = RandomGenerator.paragraph(8)(4, 8);

// Create test content for forms
const placeholder = RandomGenerator.paragraph(3)(5, 10);

// Generate variable-length test data
const testTexts = Array.from({ length: 5 }, (_, i) =>
RandomGenerator.paragraph(i + 2)(3, 6)
);
  • Parameters

    • sentences: number = ...

      Number of sentences (words) in the paragraph (default: random 2-5)

    Returns (wordMin?: number, wordMax?: number) => string

    A currying function that accepts word length parameters