After modifying indexes modulo isn't needed, it appears

This commit is contained in:
Piotr Czajkowski
2022-01-01 13:17:35 +01:00
parent a1fd52ebfd
commit cf65935615

View File

@@ -53,10 +53,9 @@ namespace Buzzword
static string GeneratePhrase() static string GeneratePhrase()
{ {
// Indexing from 0, so had to decrease generated numbers // Indexing from 0, so had to decrease generated numbers
// modulo Phrases.Length added to not get out of bond return $"{Capitalize(Phrases[(int)(13 * rnd.NextDouble())])} "
return $"{Capitalize(Phrases[(int)(13 * rnd.NextDouble()) % Phrases.Length])} " + $"{Phrases[(int)(13 * rnd.NextDouble() + 13)]} "
+ $"{Phrases[(int)(13 * rnd.NextDouble() + 13) % Phrases.Length]} " + $"{Phrases[(int)(13 * rnd.NextDouble() + 26)]}";
+ $"{Phrases[(int)(13 * rnd.NextDouble() + 26) % Phrases.Length]}";
} }
static bool Decision() static bool Decision()