Skip to content
Snippets Groups Projects
Commit c7630349 authored by Philip Kaluđerčić's avatar Philip Kaluđerčić :u7121:
Browse files

Update comment in shuf

parent 7b52e818
No related branches found
No related tags found
No related merge requests found
// This horrible file is distributed under the CC0 license. Consult // This horrible file is distributed under the CC0 license. Consult
// ./LICENSE for more details. // ./LICENSE for more details.
// $Id: quiz.js,v 1.2 2024/01/11 16:19:30 oj14ozun Exp oj14ozun $ // $Id: quiz.js,v 1.3 2024/01/12 10:15:28 oj14ozun Exp oj14ozun $
"use strict"; "use strict";
...@@ -27,8 +27,7 @@ var opts = []; // DOM objects of each answer ...@@ -27,8 +27,7 @@ var opts = []; // DOM objects of each answer
var progress = JSON.parse(window.localStorage.getItem("progress")) || {}; var progress = JSON.parse(window.localStorage.getItem("progress")) || {};
function shuf(arr) { function shuf(arr) { // shuffle arr using Fisher–Yates shuffle
// shuffle option-order using Fisher–Yates shuffle
for (let i = 0; i < arr.length - 1; i++) { for (let i = 0; i < arr.length - 1; i++) {
const j = Math.floor(Math.random() * arr.length); const j = Math.floor(Math.random() * arr.length);
const tmp = arr[j]; const tmp = arr[j];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment