MCPcopy Index your code
hub / github.com/scality/cloudserver / shuffle

Function shuffle

tests/unit/helpers.js:46–59  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

44}
45
46function shuffle(array) {
47 let randomIndex;
48 let temporaryValue;
49 const length = array.length;
50 array.forEach((item, currentIndex, array) => {
51 randomIndex = Math.floor(Math.random() * length);
52 temporaryValue = array[currentIndex];
53 // eslint-disable-next-line no-param-reassign
54 array[currentIndex] = array[randomIndex];
55 // eslint-disable-next-line no-param-reassign
56 array[randomIndex] = temporaryValue;
57 });
58 return array;
59}
60
61function timeDiff(startTime) {
62 const timeArray = process.hrtime(startTime);

Callers 1

bucket_mem_api.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected