MCPcopy Create free account
hub / github.com/LevelUpWeb3/app / shuffleArray

Function shuffleArray

src/utils/common.ts:70–76  ·  view source on GitHub ↗
(array: any[])

Source from the content-addressed store, hash-verified

68}
69
70export const shuffleArray = (array: any[]) => {
71 for (let i = array.length - 1; i > 0; i--) {
72 const j = Math.floor(Math.random() * (i + 1));
73 [array[i], array[j]] = [array[j], array[i]];
74 }
75 return array;
76};
77
78/**
79 * Deep merges objects while removing nullish (null/undefined) values

Callers 1

MoreContentSlideFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected