Optionalprops: Partial<{ sentences: number; wordMax: number; wordMin: number }>
Optional configuration object with sentences count and word length ranges
A string containing the generated paragraph
// Generate with defaults (random 2-5 words, 3-7 characters each)
RandomGenerator.paragraph(); // e.g. "lorem ipsum dolor"
// Specific number of sentences
RandomGenerator.paragraph({ sentences: 5 }); // "lorem ipsum dolor sit amet"
// Custom word length ranges
RandomGenerator.paragraph({ sentences: 4, wordMin: 2, wordMax: 5 });
// "ab cd ef gh"
// Generate product descriptions
const description = RandomGenerator.paragraph({
sentences: 8,
wordMin: 4,
wordMax: 8,
});
// Create test content for forms
const placeholder = RandomGenerator.paragraph({
sentences: 3,
wordMin: 5,
wordMax: 10,
});
contracts/common.md#principled-implementation A paragraph is a number of words joined by spaces, each word a random lowercase string of a length between the minimum and maximum, with the defaults of two to five words of three to seven letters.
contracts/common.md#clear-and-simple-design One expression over alphabets, with three optional numbers.
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. Accepts an optional configuration object for fine-tuned control over the paragraph structure.
Processing cost: Each requested word is generated once; time and temporary space scale with the total generated character count and the number of words.