Class TestTextGenerator
Provides static methods for generating placeholder text including Lorem Ipsum paragraphs, random sentences, pangrams, and mixed text lines. Intended for use during UI prototyping, layout testing, font previews, and development scaffolding where realistic-looking but semantically meaningless text is needed.
Inherited Members
Namespace: Scylla.Core.Util
Assembly: ScyllaCore.dll
Syntax
public static class TestTextGenerator
Remarks
Text generation can be performed in two modes:
-
Stateful (default): Methods without a
seedparameter use a shared RandomUtil.DeterministicRNG instance seeded with42at startup. The generator advances across consecutive calls, so the same method called twice will return different results unless SetSeed(int) is called between them. -
Deterministic (seeded): Methods that accept a
seedparameter create a fresh, isolated RandomUtil.DeterministicRNG each call. Given the same seed, the same output is always produced, making these overloads suitable for reproducible test fixtures and snapshot testing.
The Lorem Ipsum vocabulary contains 63 classical Latin words. Sentences are capitalized at the first word and terminated with a period. Pangrams are drawn from a built-in set of 20 English pangrams, all of which contain every letter of the alphabet at least once.
Fields
LOREM_IPSUM_START
The canonical opening sentence of the Lorem Ipsum placeholder text, exactly as it has been used in typesetting since the 1500s. Exposed as a constant for use cases where a fixed, well-known string is preferable over procedural generation.
Declaration
public const string LOREM_IPSUM_START = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
Field Value
| Type | Description |
|---|---|
| string |
See Also
Methods
GenerateLines(int)
Generates a list of lineCount text lines by randomly mixing Lorem
Ipsum sentences (approximately 33% probability) with pangrams (approximately 67%
probability). This blend produces visually diverse output useful for font previews
and multi-line layout testing. Uses the shared stateful RNG.
Declaration
public static List<string> GenerateLines(int lineCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lineCount | The number of text lines to generate. Values of zero or less return an empty list rather than throwing. Defaults to 1. |
Returns
| Type | Description |
|---|---|
| List<string> | A List<T> of strings, each being either a Lorem Ipsum sentence
(5-20 words) or a pangram drawn from the built-in collection. Returns an empty
list if |
See Also
GenerateLines(int, int)
Generates a list of lineCount text lines using a fresh RNG seeded
with seed. Applies the same 33/67 Lorem Ipsum / pangram mixing
as GenerateLines(int), but is fully deterministic: the same seed and
count always produce the same list.
Declaration
public static List<string> GenerateLines(int lineCount, int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| int | lineCount | The number of text lines to generate. Values of zero or less return an empty list rather than throwing. |
| int | seed | An integer seed controlling all random choices. The same seed and line count always produce the same list of lines. |
Returns
| Type | Description |
|---|---|
| List<string> | A List<T> of strings with deterministically selected Lorem Ipsum
sentences and pangrams. Returns an empty list if |
See Also
GenerateParagraph(int, int, int)
Generates a single paragraph composed of sentenceCount Lorem Ipsum
sentences joined by spaces. Uses the shared stateful RNG.
Declaration
public static string GenerateParagraph(int minWords = 8, int maxWords = 20, int sentenceCount = 5)
Parameters
| Type | Name | Description |
|---|---|---|
| int | minWords | The minimum number of words per sentence. Values less than 1 are clamped to 1. Defaults to 8. |
| int | maxWords | The maximum number of words per sentence. If less than |
| int | sentenceCount | The exact number of sentences to include in the paragraph. Values less than 1 are clamped to 1. Defaults to 5. |
Returns
| Type | Description |
|---|---|
| string | A paragraph string consisting of |
Remarks
This method reuses a shared StringBuilder for efficiency. It is not thread-safe; use GenerateParagraphSeeded(int, int, int, int) for isolated, thread-safe generation.
See Also
GenerateParagraphSeeded(int, int, int, int)
Generates a single paragraph of Lorem Ipsum text using a fresh RNG seeded with
seed. The same combination of arguments always produces the
same paragraph, making this overload suitable for deterministic test fixtures or
snapshot tests. Unlike GenerateParagraph(int, int, int), this method allocates its
own StringBuilder and is safe to call from multiple contexts.
Declaration
public static string GenerateParagraphSeeded(int seed, int minWords = 8, int maxWords = 20, int sentenceCount = 5)
Parameters
| Type | Name | Description |
|---|---|---|
| int | seed | An integer seed controlling all word count selections and word choices. The same seed and parameters always produce the same paragraph string. |
| int | minWords | The minimum number of words per sentence. Values less than 1 are clamped to 1. Defaults to 8. |
| int | maxWords | The maximum number of words per sentence. If less than |
| int | sentenceCount | The exact number of sentences to include in the paragraph. Values less than 1 are clamped to 1. Defaults to 5. |
Returns
| Type | Description |
|---|---|
| string | A deterministically generated paragraph string consisting of
|
See Also
GenerateParagraphs(int, int, int, int, int, string)
Generates multiple paragraphs of Lorem Ipsum text joined by paragraphSeparator.
The number of sentences per paragraph is randomized within the provided range, giving
natural-looking variation. Uses the shared stateful RNG.
Declaration
public static string GenerateParagraphs(int paragraphCount, int minWords = 8, int maxWords = 20, int minSentences = 4, int maxSentences = 8, string paragraphSeparator = "\n\n")
Parameters
| Type | Name | Description |
|---|---|---|
| int | paragraphCount | The number of paragraphs to generate. Values of zero or less return an empty string rather than throwing. |
| int | minWords | The minimum number of words per sentence. Values less than 1 are clamped to 1. Defaults to 8. |
| int | maxWords | The maximum number of words per sentence. If less than |
| int | minSentences | The minimum number of sentences per paragraph. Values less than 1 are clamped to 1. Defaults to 4. |
| int | maxSentences | The maximum number of sentences per paragraph. If less than |
| string | paragraphSeparator | The string inserted between consecutive paragraphs. Defaults to |
Returns
| Type | Description |
|---|---|
| string | A single string containing all generated paragraphs joined by
|
Remarks
This method reuses a shared StringBuilder for efficiency. It is not thread-safe. For isolated generation, create a seeded paragraph per iteration using GenerateParagraphSeeded(int, int, int, int) and join them manually.
See Also
GenerateSentence(int, int)
Generates a single sentence composed of a random number of Lorem Ipsum words in the
range [minWords, maxWords]. The sentence is
capitalized at its first word and terminated with a period. Uses the shared stateful RNG.
Declaration
public static string GenerateSentence(int minWords = 5, int maxWords = 15)
Parameters
| Type | Name | Description |
|---|---|---|
| int | minWords | The minimum number of words in the sentence. Values less than 1 are clamped to 1. Defaults to 5. |
| int | maxWords | The maximum number of words in the sentence. If less than |
Returns
| Type | Description |
|---|---|
| string | A sentence string beginning with a capitalized word and ending with a period,
containing between |
See Also
GenerateSentenceSeeded(int, int, int)
Generates a single sentence using a fresh RNG seeded with seed,
making the output fully deterministic for a given combination of arguments.
Declaration
public static string GenerateSentenceSeeded(int seed, int minWords = 5, int maxWords = 15)
Parameters
| Type | Name | Description |
|---|---|---|
| int | seed | An integer seed that controls both the word count selection and all word choices. The same seed with the same range parameters always returns the same sentence. |
| int | minWords | The minimum number of words in the sentence. Values less than 1 are clamped to 1. Defaults to 5. |
| int | maxWords | The maximum number of words in the sentence. If less than |
Returns
| Type | Description |
|---|---|
| string | A deterministically generated sentence beginning with a capitalized word and ending with a period. |
See Also
GenerateSentences(int, int, int)
Generates an array of count random sentences, each containing
between minWords and maxWords Lorem Ipsum words.
Uses the shared stateful RNG; each call advances the shared state.
Declaration
public static string[] GenerateSentences(int count, int minWords = 5, int maxWords = 15)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of sentences to generate. Values of zero or less return an empty array rather than throwing. |
| int | minWords | The minimum number of words per sentence. Values less than 1 are clamped to 1. Defaults to 5. |
| int | maxWords | The maximum number of words per sentence. If less than |
Returns
| Type | Description |
|---|---|
| string[] | An array of |
See Also
GenerateWord()
Returns a single random word drawn from the Lorem Ipsum vocabulary using the shared stateful RNG. Each call advances the shared RNG state.
Declaration
public static string GenerateWord()
Returns
| Type | Description |
|---|---|
| string | A lowercase word from Scylla.Core.Util.TestTextGenerator.LOREM_IPSUM_WORDS. The returned string is always one of the 63 predefined Latin words. |
See Also
GenerateWord(int)
Returns a single random word drawn from the Lorem Ipsum vocabulary using a fresh
RNG seeded with seed. The same seed always produces the same word,
making this overload suitable for deterministic test fixtures.
Declaration
public static string GenerateWord(int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| int | seed | An integer seed value. The same seed always returns the same word regardless of previous calls. Use distinct values to obtain different words. |
Returns
| Type | Description |
|---|---|
| string | A lowercase word from Scylla.Core.Util.TestTextGenerator.LOREM_IPSUM_WORDS that is deterministically
selected based on |
See Also
GenerateWords(int)
Returns an array of count random words drawn from the Lorem Ipsum
vocabulary using the shared stateful RNG. Each call advances the shared RNG state by
count steps.
Declaration
public static string[] GenerateWords(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of words to generate. Values of zero or less return an empty array rather than throwing. |
Returns
| Type | Description |
|---|---|
| string[] | An array of |
See Also
GenerateWords(int, int)
Returns an array of count random words drawn from the Lorem Ipsum
vocabulary using a fresh RNG seeded with seed. The same combination
of count and seed always produces the same array.
Declaration
public static string[] GenerateWords(int count, int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of words to generate. Values of zero or less return an empty array rather than throwing. |
| int | seed | An integer seed value. Provides full determinism: the same seed and count always produce the same sequence of words. |
Returns
| Type | Description |
|---|---|
| string[] | An array of |
See Also
GetAllPangrams()
Returns a copy of the complete built-in pangram collection as a new array. The returned array is independent of the internal storage and may be freely modified by the caller.
Declaration
public static string[] GetAllPangrams()
Returns
| Type | Description |
|---|---|
| string[] | A new |
See Also
GetClassicLoremIpsum()
Returns the value of the LOREM_IPSUM_START constant - the classic opening sentence of Lorem Ipsum. Use this when a well-known, fixed placeholder string is preferable over procedurally generated text.
Declaration
public static string GetClassicLoremIpsum()
Returns
| Type | Description |
|---|---|
| string | The string |
See Also
GetPangram(int)
Returns the pangram at the specified zero-based index within
the built-in collection. Use GetPangramCount() to determine the valid
index range before calling this method.
Declaration
public static string GetPangram(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the pangram to retrieve. Must be in the range [0, GetPangramCount() - 1] inclusive. |
Returns
| Type | Description |
|---|---|
| string | The pangram string at position |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown when |
See Also
GetPangramCount()
Returns the total number of pangrams available in the built-in collection. Use this to validate index values before calling GetPangram(int).
Declaration
public static int GetPangramCount()
Returns
| Type | Description |
|---|---|
| int | The count of built-in pangrams; always 20 in the current implementation. |
See Also
GetRandomPangram()
Returns a randomly selected pangram from the built-in collection of 20 pangrams, using the shared stateful RNG. Pangrams are useful for font-coverage testing because each sentence contains all 26 letters of the English alphabet.
Declaration
public static string GetRandomPangram()
Returns
| Type | Description |
|---|---|
| string | One of the 20 built-in pangram strings, selected at random. The returned string is a direct reference to the internal array element and should not be mutated. |
See Also
GetRandomPangram(int)
Returns a pangram deterministically selected from the built-in collection using a
fresh RNG seeded with seed. The same seed always yields the same pangram.
Declaration
public static string GetRandomPangram(int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| int | seed | An integer seed controlling which pangram is returned. Different seeds will typically yield different pangrams, but collisions are possible since the collection contains only 20 entries. |
Returns
| Type | Description |
|---|---|
| string | The pangram from the built-in collection at the index determined by |
See Also
RandomizeSeed()
Replaces the shared stateful RNG with a new instance seeded from the current UTC time in ticks, making subsequent unseeded generation calls non-deterministic. Use this in production contexts where repeated identical output is undesirable.
Declaration
public static void RandomizeSeed()
See Also
SetSeed(int)
Replaces the shared stateful RNG with a new instance seeded by seed.
After this call, all unseeded generation methods will produce a deterministic sequence
starting from seed. Useful for establishing a reproducible test
baseline before a sequence of generation calls.
Declaration
public static void SetSeed(int seed)
Parameters
| Type | Name | Description |
|---|---|---|
| int | seed | The integer seed value to initialize the shared RNG with. |