forked from mrlan/EnglishPal
Fix bug 570
parent
8664da12de
commit
eb2051ca3f
|
@ -201,7 +201,7 @@ function random_select_word(word) {
|
||||||
// 将NodeList转换为数组
|
// 将NodeList转换为数组
|
||||||
let wordContainersArray = [...wordContainers];
|
let wordContainersArray = [...wordContainers];
|
||||||
|
|
||||||
// 随机打乱数组
|
// 随机打乱数组,乱序
|
||||||
for (let i = wordContainersArray.length - 1; i > 0; i--) {
|
for (let i = wordContainersArray.length - 1; i > 0; i--) {
|
||||||
const j = Math.floor(Math.random() * (i + 1));
|
const j = Math.floor(Math.random() * (i + 1));
|
||||||
[wordContainersArray[i], wordContainersArray[j]] = [wordContainersArray[j], wordContainersArray[i]];
|
[wordContainersArray[i], wordContainersArray[j]] = [wordContainersArray[j], wordContainersArray[i]];
|
||||||
|
|
Loading…
Reference in New Issue