diff options
author | sanine <sanine.not@pm.me> | 2023-11-11 23:05:12 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-11-11 23:05:12 -0600 |
commit | 661847f269030c0cbaa681e2d4697873f891cdec (patch) | |
tree | 8128128b920d37e50f07647ebfd0078db15f43e0 /src/util.js | |
parent | b778ab8b5a547328c044b47c99ec79661283c151 (diff) |
fix team information for empty cells
Diffstat (limited to 'src/util.js')
-rw-r--r-- | src/util.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.js b/src/util.js index ecae45e..f83039f 100644 --- a/src/util.js +++ b/src/util.js @@ -50,3 +50,13 @@ export function apply(f, n, x0) { return f(apply(f, n-1, x0));
}
}
+
+
+export function shuffle(arr) {
+ const shuffled = [...arr];
+ for (let i=arr.length-1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i+1));
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]]
+ }
+ return shuffled;
+}
|