From cf659356152ef6c3111734844dbaf93962b46aa6 Mon Sep 17 00:00:00 2001 From: Piotr Czajkowski Date: Sat, 1 Jan 2022 13:17:35 +0100 Subject: [PATCH] After modifying indexes modulo isn't needed, it appears --- 20_Buzzword/csharp/Program.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/20_Buzzword/csharp/Program.cs b/20_Buzzword/csharp/Program.cs index ec07d18d..d4311141 100644 --- a/20_Buzzword/csharp/Program.cs +++ b/20_Buzzword/csharp/Program.cs @@ -53,10 +53,9 @@ namespace Buzzword static string GeneratePhrase() { // 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()) % Phrases.Length])} " - + $"{Phrases[(int)(13 * rnd.NextDouble() + 13) % Phrases.Length]} " - + $"{Phrases[(int)(13 * rnd.NextDouble() + 26) % Phrases.Length]}"; + return $"{Capitalize(Phrases[(int)(13 * rnd.NextDouble())])} " + + $"{Phrases[(int)(13 * rnd.NextDouble() + 13)]} " + + $"{Phrases[(int)(13 * rnd.NextDouble() + 26)]}"; } static bool Decision()