private static void GenerateRandomValue() { if (Generator is null) { Generator = new MyGenerator(); } if (GeneratedValueQueue is null) { GeneratedValueQueue = new Queue <MyBigInteger>(); } var randomNumber = Generator.GetNextRandomValue(); Console.WriteLine($"Generated number: {randomNumber}"); GeneratedValueQueue.Enqueue(randomNumber); }
private void FindRealPoint(ConcurrentQueue <List <MyPoint> > batches) { var randomValue = _randomValues.Dequeue(); var stopwatch = new Stopwatch(); stopwatch.Start(); while (batches.TryDequeue(out List <MyPoint> batch)) { foreach (var point in batch) { var generator = new MyGenerator(point); var generatedValue = generator.GetNextRandomValue(false); if (generatedValue != randomValue) { continue; } Console.WriteLine("Cracked"); Console.WriteLine($"{stopwatch.Elapsed}"); return; } } }