From 246b9f2091e20329794d40169caf3f9713ca86fb Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 27 May 2026 13:04:58 +0000
Subject: [PATCH 1/2] Initial plan
From 975ed6239b1a1553338f4b4a44998b4d84c29c7d Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 27 May 2026 13:09:48 +0000
Subject: [PATCH 2/2] fix(csharp): ensure GenerateRandomEvenNumber always
returns even
---
csharp/CornTest.Tests/RandomMathOperationsTest.cs | 4 +---
csharp/CornTest/RandomMathOperations.cs | 14 ++------------
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/csharp/CornTest.Tests/RandomMathOperationsTest.cs b/csharp/CornTest.Tests/RandomMathOperationsTest.cs
index 351ee45..b01966b 100644
--- a/csharp/CornTest.Tests/RandomMathOperationsTest.cs
+++ b/csharp/CornTest.Tests/RandomMathOperationsTest.cs
@@ -4,9 +4,7 @@ namespace CornTest.Tests;
///
/// Tests for .
-/// The even-number tests are intentionally flaky because the underlying
-/// method has a 5% chance of returning an odd number. With 20 iterations
-/// the probability of at least one failure is roughly 64%.
+/// The even-number tests validate that generated values are always even.
///
public class RandomMathOperationsTest
{
diff --git a/csharp/CornTest/RandomMathOperations.cs b/csharp/CornTest/RandomMathOperations.cs
index 07f2a60..6d2e339 100644
--- a/csharp/CornTest/RandomMathOperations.cs
+++ b/csharp/CornTest/RandomMathOperations.cs
@@ -2,7 +2,7 @@ namespace CornTest;
///
/// Provides random number generation operations for testing flake detection.
-/// The GenerateRandomEvenNumber method contains an intentional 5% flaw.
+/// The GenerateRandomEvenNumber method always returns an even value.
///
public class RandomMathOperations
{
@@ -30,21 +30,11 @@ public int GenerateRandomOddNumber()
///
/// Produces a random even integer in the range [0, 100].
- ///
- /// Intentional flaw: approximately 5% of invocations will
- /// corrupt the result by adding 1, yielding an odd number instead.
- ///
///
public int GenerateRandomEvenNumber()
{
// _rng.Next(51) yields 0..50, so result is 0,2,4,...,100
- int value = _rng.Next(51) * 2;
-
- // Intentional flaw: with ~5% probability, corrupt the even number
- if (_rng.NextDouble() < 0.05)
- value += 1;
-
- return value;
+ return _rng.Next(51) * 2;
}
///