From 661847f269030c0cbaa681e2d4697873f891cdec Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 11 Nov 2023 23:05:12 -0600 Subject: fix team information for empty cells --- src/util.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util.js') 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; +} -- cgit v1.2.1