Repository navigation
Commit 188b7c9
test(rand): bound the crypto-backed distribution test by binomial sigmas, not a fixed 7% (MAG-4280)
TestProtocolRandDistribution reused isUniformlyDistributed, whose fixed 7%
per-slot bound was written for seeded sources: on those it passes or fails
the same way every run. The protocol rand draws from crypto/rand, so the
test differs each run. Each slot's count is Binomial(100000, 1/50), mean
2000 and sigma 44.3, which makes 7% only 3.2 sigmas; over the 4 x 50 slots
one run checks, about one run in four failed (seen on a stacked branch:
slot 29 off by 7.2%).
isUniformWithinSigmas bounds each slot at six sigmas of that distribution,
about one failing run in 2.5 million. The seeded tests keep the old helper.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent cc2b188 commit 188b7c9
1 file changed
Lines changed: 32 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
67 | 95 | | |
68 | 96 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
73 | 101 | | |
74 | 102 | | |
0 commit comments