squid 756112cb21 BLOG-5 docs: add comment for next config squid c16e3f29a0 BLOG-5 refactor: apply clean architecture directory structure squid 7f1a202cc7 BLOG-5 feat: self tags animation squid 738008b983 BLOG-5 refactor: remove unused props definition squid 90c8a2f627 BLOG-5 feat: home page fisrt view desktop layout zoe d76f54b2b1 BLOG-5 feat: mobile home page first view Reviewed-on: #15 Co-authored-by: SquidSpirit <squid@squidspirit.com> Co-committed-by: SquidSpirit <squid@squidspirit.com>
9 lines
277 B
TypeScript
9 lines
277 B
TypeScript
export default function shuffleArray<T>(array: T[]): T[] {
|
|
const newArray = [...array];
|
|
for (let i = newArray.length - 1; i > 0; i--) {
|
|
const j = Math.floor(Math.random() * (i + 1));
|
|
[newArray[i], newArray[j]] = [newArray[j], newArray[i]];
|
|
}
|
|
return newArray;
|
|
}
|