From 3a5d21db11a2f128e5f51df9c123b7abc367c778 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 20 Nov 2023 09:26:06 -0800 Subject: randomize avatars --- src/lib/utils.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/utils.js') diff --git a/src/lib/utils.js b/src/lib/utils.js index 9e1066e2..9b3e5592 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -256,3 +256,11 @@ export let types = { }; export let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t); + + export function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + } + -- cgit v1.2.3