diff --git a/src/Moniker/NameGenerator.cs b/src/Moniker/NameGenerator.cs index 42824c8..103a229 100644 --- a/src/Moniker/NameGenerator.cs +++ b/src/Moniker/NameGenerator.cs @@ -33,8 +33,7 @@ public static string Generate(MonikerStyle monikerStyle, string delimiter = Defa /// /// The style of random name. /// The adjective part of the random name. - /// The adjective part of the random name. - /// The generated random name. + /// The noun part of the random name. /// public static void Generate(MonikerStyle monikerStyle, out Chars adjective, out Chars noun) { @@ -61,7 +60,8 @@ public static string GenerateMoniker(string delimiter = DefaultDelimiter) /// /// Generate a random name in the 'moniker' project style. /// - /// The generated random name. + /// The adjective part of the random name. + /// The noun part of the random name. public static void GenerateMoniker(out Chars adjective, out Chars noun) => BuildNamePair(MonikerDescriptors.Strings, out adjective, MonikerAnimals.Strings, out noun); @@ -77,22 +77,6 @@ public static string GenerateMoby(string delimiter = DefaultDelimiter) return Join(adjective, delimiter, noun); } - private static string Join(Chars adjective, ReadOnlySpan delimiter, Chars noun) - { - var length = adjective.Length + delimiter.Length + noun.Length; - var chars = length <= 64 ? stackalloc char[length] : new char[length]; - - var writeCount = adjective.Write(chars); - Debug.Assert(writeCount == adjective.Length); - - delimiter.CopyTo(chars[adjective.Length..]); - - writeCount = noun.Write(chars[(adjective.Length + delimiter.Length)..]); - Debug.Assert(writeCount == noun.Length); - - return new(chars); - } - /// /// Generate a random name in the 'moby' project style. /// @@ -125,5 +109,21 @@ private static Chars GetRandomEntry(Utf8Strings entries) var index = Random.Shared.Next(entries.Count); return entries[index]; } + + private static string Join(Chars adjective, ReadOnlySpan delimiter, Chars noun) + { + var length = adjective.Length + delimiter.Length + noun.Length; + var chars = length <= 64 ? stackalloc char[length] : new char[length]; + + var writeCount = adjective.Write(chars); + Debug.Assert(writeCount == adjective.Length); + + delimiter.CopyTo(chars[adjective.Length..]); + + writeCount = noun.Write(chars[(adjective.Length + delimiter.Length)..]); + Debug.Assert(writeCount == noun.Length); + + return new(chars); + } } }