Skip to content

Commit

Permalink
Compute disallowed result once
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz committed Jan 8, 2020
1 parent c1b4c59 commit 2249f1e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Moniker/NameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ private static string BuildNamePair(

string result;
var (disallowedAdjective, disallowedNoun) = disallowed;
var disallowedResult = $"{disallowedAdjective}{delimiter}{disallowedNoun}";

do
{
var adjective = GetRandomEntry(adjectives);
var noun = GetRandomEntry(nouns);
result = $"{adjective}{delimiter}{noun}";
} while (result == $"{disallowedAdjective}{delimiter}{disallowedNoun}");
} while (result == disallowedResult);

return result;
}
Expand Down

0 comments on commit 2249f1e

Please sign in to comment.