From ee8d15697a3b758b8f26d7074edf017b3db6d480 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 20 Nov 2023 09:17:24 -0800 Subject: randomize locations --- src/components/LocationsMap.svelte | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index a06c993b..6f84408e 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -126,8 +126,16 @@ } inview = inview.sort((a, b) => a.tags.name.localeCompare(b.tags.name)); + shuffleArray(inview); } +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]]; + } +} + let popups = {}; let counter = 0; @@ -231,16 +239,16 @@ - + + + + + + + + + +