Commit 0b2f515a by doszhang

dos

parent e81df4d6
......@@ -142,14 +142,25 @@ function randomFlag() {
function randomFlagArr(length) {
let arr = Array(length);
for (let i = 0; i < arr.length; i++) {
arr[i] = RandomNumBoth(0, flag.length - 1);
arr[i] = getRand(arr);
}
arr.sort(function (a, b) {
return a - b;
});
console.log(arr);
return arr;
}
function getRand(arr) {
let i = RandomNumBoth(0, flag.length - 1);
if (i.indexOf(arr) == -1) {
return i;
} else {
return getRand(arr);
}
}
function createItem(flag, no) {
let item = flagTemplate.clone();
item.find('.flag-no').text(no);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment