(items, rng)
| 124 | |
| 125 | // A seeded Fisher–Yates shuffle, leaving the input unchanged. |
| 126 | export function shuffled(items, rng) { |
| 127 | let result = [...items]; |
| 128 | for (let i = result.length - 1; i > 0; i--) { |
| 129 | let j = Math.floor(rng() * (i + 1)); |
| 130 | [result[i], result[j]] = [result[j], result[i]]; |
| 131 | } |
| 132 | return result; |
| 133 | } |
| 134 | |
| 135 | // Exact null distribution of the Wilcoxon signed-rank statistic for n pairs: |
| 136 | // cdf[k] is the probability that the positive-rank sum is at most k. |
no outgoing calls
no test coverage detected