MCPcopy Create free account
hub / github.com/nodejs/node / shuffle

Function shuffle

deps/v8/tools/clusterfuzz/js_fuzzer/random.js:117–124  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

115}
116
117function shuffle(array) {
118 for (let i = 0; i < array.length - 1; i++) {
119 const j = randInt(i, array.length - 1);
120 swap(array, i, j);
121 }
122
123 return array;
124}
125
126module.exports = {
127 choose: choose,

Callers 1

sampleFunction · 0.85

Calls 2

randIntFunction · 0.70
swapFunction · 0.70

Tested by

no test coverage detected