aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js8
1 files changed, 8 insertions, 0 deletions
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]];
+ }
+ }
+