Вот программа. Ошибка заключается в том, что когда генерируется "хэш", он начинает ****ится, а когда полностью был разгадан, он выводится, но проблема в том, что в конце выводится неверный хэш, неверность заключается в том, что первый символ выводится ещё и в конце, хотя не должен. using System; using System.Text; using System.IO; using System.Linq; namespace ToxicCoin { class Program { static string[] Hash(int length) { Random rn = new Random(); string[] hash = new string[length]; for (int i = 0; i < length - 1; i++) { Char s = (char)rn.Next(33,125); string symbol = s.ToString(); hash[i] = symbol; } return hash; } static string Decision(bool a) { string word = ""; if (a == true) { int kolvo = 1; Random rn = new Random(); for (int i = 0; i < kolvo; i++) { Char s = (char)rn.Next(33, 125); string symbol = s.ToString(); word += symbol; } } else { Console.WriteLine("Не"); } return word; } static void Main(string[] args) { double Counter = 0; Random rnd = new Random(); int lenght = 32; int quantity = rnd.Next(100, 444); string[] hach = Hash(32); foreach (var el in hach) { Console.Write(el); } Console.WriteLine("\n"); for (int i = 0; i < quantity; i++) { string hash = ""; int x = 0; while (hash.Length != hach.Length) { if (x >= lenght - 1) { x -= lenght - 1; } string symbol = Decision(true); Console.WriteLine($"Элемент - {symbol}"); if (symbol == hach[x]) { hash += symbol; Console.WriteLine($"Разгадан символ {symbol}"); } else { continue; } x++; if (hash.Length == hach.Length) { Console.WriteLine($"{hash} \n + 0.0000001 "); Counter += 0.0000001; break; } } break; } Console.WriteLine($"Вы получили {Counter} "); } } } Код using System; using System.Text; using System.IO; using System.Linq; namespace ToxicCoin { class Program { static string[] Hash(int length) { Random rn = new Random(); string[] hash = new string[length]; for (int i = 0; i < length - 1; i++) { Char s = (char)rn.Next(33,125); string symbol = s.ToString(); hash[i] = symbol; } return hash; } static string Decision(bool a) { string word = ""; if (a == true) { int kolvo = 1; Random rn = new Random(); for (int i = 0; i < kolvo; i++) { Char s = (char)rn.Next(33, 125); string symbol = s.ToString(); word += symbol; } } else { Console.WriteLine("Не"); } return word; } static void Main(string[] args) { double Counter = 0; Random rnd = new Random(); int lenght = 32; int quantity = rnd.Next(100, 444); string[] hach = Hash(32); foreach (var el in hach) { Console.Write(el); } Console.WriteLine("\n"); for (int i = 0; i < quantity; i++) { string hash = ""; int x = 0; while (hash.Length != hach.Length) { if (x >= lenght - 1) { x -= lenght - 1; } string symbol = Decision(true); Console.WriteLine($"Элемент - {symbol}"); if (symbol == hach[x]) { hash += symbol; Console.WriteLine($"Разгадан символ {symbol}"); } else { continue; } x++; if (hash.Length == hach.Length) { Console.WriteLine($"{hash} \n + 0.0000001 "); Counter += 0.0000001; break; } } break; } Console.WriteLine($"Вы получили {Counter} "); } } }