MCPcopy Create free account
hub / github.com/dailydotdev/apps / shuffleArray

Function shuffleArray

packages/shared/src/lib/func.ts:222–235  ·  view source on GitHub ↗
(array: T[])

Source from the content-addressed store, hash-verified

220};
221
222export const shuffleArray = <T>(array: T[]): T[] => {
223 const newArray = array.slice();
224
225 // fisher-yates
226 for (let i = newArray.length - 1; i > 0; i -= 1) {
227 const j = Math.floor(Math.random() * (i + 1));
228
229 const temp = newArray[i];
230 newArray[i] = newArray[j];
231 newArray[j] = temp;
232 }
233
234 return newArray;
235};
236
237export const initReactModal = ({
238 modalObject,

Callers 5

AcquisitionFormInnerFunction · 0.90
PostPluginsWidgetFunction · 0.90
orderOptionsFunction · 0.90
useDeckFunction · 0.90
TokenCreatedPluginsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected