NameGenerator

Generates names by constructing syllables and joining them together.

Implements: Archigen.IGenerator<System.String>, IRandomizable

Constructors

Constructor
Description

NameGenerator()

Initializes a new instance of the NameGenerator class with no symbols, no transformer, and no filter.

NameGenerator(System.String firstSymbols, System.String middleSymbols)

Initializes a new NameGenerator with specified symbol pools for the first and middle symbol positions of a syllable. Each character in the provided strings is considered a separate symbol. The generated syllables will be used for all positions of a name.

NameGenerator(System.String firstSymbols, System.String middleSymbols, System.String lastSymbols)

Initializes a new NameGenerator with specified symbol pools for the first, middle, and last symbol positions of a syllable. Each character in the provided strings is considered a separate symbol. The generated syllables will be used for all positions of a name.

Methods

Method
Returns
Description

Next()

System.String

Generates a name and returns it as a string.

SetFilter(INameFilter filter)

Sets the name filter to use when generating names. Returns this instance of NameGenerator for chaining.

SetSize(System.Int32 size)

Sets both the minimum and maximum number of syllables to use per name. Returns this instance of NameGenerator for chaining.

SetSize(System.Int32 minSize, System.Int32 maxSize)

Sets the minimum and maximum number of syllables to use per name. Returns this instance of NameGenerator for chaining.

SetSyllables(SyllablePosition position, ISyllableGenerator generator)

Sets the SyllableGenerator for the specified position. Returns this instance of NameGenerator for chaining.

SetTransform(INameTransformer transformer)

Sets the name transformer to use when generating names. Returns this instance of NameGenerator for chaining.

Properties

Property
Type
Description

MaximumRetries

System.Int32

If this generator has a filter, this is the maximum attempts that will be made to satisfy the filter before an InvalidOperationException is thrown. The default maximum retry count is 1000.

MaximumSize

System.Int32

The maximum number of syllables in generated names. The default maximum size is 3 syllables.

MinimumSize

System.Int32

The minimum number of syllables in generated names. The default minimum size is 2 syllables.

NameFilter

The filter used to control generated names. Can be null if no filter is being used.

NameTransformer

The transformer used to modify generated names. Can be null if no transform is being used.

Random

System.Random

The instance of System.Random used to simulate randomness.

SyllableGenerators

System.Collections.Generic.Dictionary <SyllablePosition,ISyllableGenerator>

Last updated