Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 3c7fc3f

Browse files
committed
Merge pull request #1987 from stephentoub/random_test
Fix RandomNumberGeneratorTest.ConcurrentAccess failures
2 parents 39342a0 + b62e1e6 commit 3c7fc3f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/System.Security.Cryptography.RandomNumberGenerator/tests/RandomNumberGeneratorTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ private static void AssertNeutralParity(byte[] random)
202202

203203
// Over the long run there should be about as many 1s as 0s.
204204
// This isn't a guarantee, just a statistical observation.
205-
// Allow a 3% tolerance band before considering it to have gotten out of hand.
206-
Assert.True(bitDifference < 0.03);
205+
// Allow a 7% tolerance band before considering it to have gotten out of hand.
206+
const double AllowedTolerance = 0.07;
207+
Assert.True(bitDifference < AllowedTolerance,
208+
"Expected bitDifference < " + AllowedTolerance + ", got " + bitDifference + ".");
207209
}
208210
}
209-
}
211+
}

0 commit comments

Comments
 (0)