diff --git a/public/root.html b/public/root.html index 8b8ca28..9650b4e 100644 --- a/public/root.html +++ b/public/root.html @@ -37,6 +37,18 @@ map((key) => [ [key, knowledgebase[key]] ]) + function shuffle(array) { + let currentIndex = array.length, randomIndex; + while (currentIndex != 0) { + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex--; + [array[currentIndex], array[randomIndex]] = [ + array[randomIndex], array[currentIndex]]; + } + return array; + } + shuffle(knowledgebase) + console.log(0, knowledgebase) function passQuestion(form) {