MCPcopy Create free account
hub / github.com/adobe/react-spectrum / shuffled

Function shuffled

perf/report.mjs:126–133  ·  view source on GitHub ↗
(items, rng)

Source from the content-addressed store, hash-verified

124
125// A seeded Fisher–Yates shuffle, leaving the input unchanged.
126export 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.

Callers 2

runFunction · 0.90
report.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected