Generates random multi-paragraph content with customizable structure.

Creates content consisting of multiple paragraphs separated by double newlines. Uses a triple-currying pattern to allow fine-grained control over content structure: paragraphs count → sentences per paragraph → word character lengths. Ideal for generating realistic-looking text content for testing.

  // Generate with all defaults
const article = RandomGenerator.content()()();

// Specific structure: 5 paragraphs, 15-25 sentences each, 4-8 char words
const longContent = RandomGenerator.content(5)(15, 25)(4, 8);

// Short content with brief sentences
const shortContent = RandomGenerator.content(2)(5, 8)(2, 4);

// Generate blog post content
const blogPost = {
title: RandomGenerator.name(3),
content: RandomGenerator.content(4)(10, 20)(3, 7),
summary: RandomGenerator.paragraph(2)(5, 10)
};

// Create test data for CMS
const pages = Array.from({ length: 10 }, () => ({
id: RandomGenerator.alphaNumeric(8),
content: RandomGenerator.content(randint(2, 6))(8, 15)(4, 9)
}));

// Generate email content for testing
const emailBody = RandomGenerator.content(3)(5, 12)(3, 8);
  • Parameters

    • paragraphs: number = ...

      Number of paragraphs to generate (default: random 3-8)

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

    A currying function that accepts sentence count parameters