diff --git a/game.js b/game.js index 9ac8356..6921b9f 100644 --- a/game.js +++ b/game.js @@ -944,7 +944,15 @@ class Game { if (this.state.questions.length>0) { cb(); return; } fetch('./questions.json') .then(r=>r.json()) - .then(data=>{ this.state.questions=data.levels[0].questions; cb(); }) + .then(data=>{ + const qs = data.levels[0].questions; + for (let i = qs.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [qs[i], qs[j]] = [qs[j], qs[i]]; + } + this.state.questions = qs; + cb(); + }) .catch(()=>this.toast('❌ Could not load questions.json')); }