YUYU

胖鱼鱼

鱼儿游回

1 分钟阅读

function shuffle(arr) {
    var ci = arr.length,
        tmp, ri;
    while (0 !== ci) {
        ri = Math.floor(Math.random() * ci);
        ci -= 1;
        tmp = arr[ci];
        arr[ci] = arr[ri];
        arr[ri] = tmp;
    }
    return arr;
}
var jj = [];
for (var i = 10; i >= 0; i--) {
    for (var j = 0; j < i; j++) {
        jj.push(i + "-" + j + "=");
        jj.push(j + "+" + (10 - i) + "=")
    }
};
var njj = shuffle(jj);
document.write("<table><tr>");
for (var i = 0; i < jj.length; i++) {
    var br = "";
    if ((i + 1) % 6 == 0) {
        br = "</tr><tr>";
    }
    document.write("<td>" + jj[i] + "</td>" + br)
}
document.write("</tr></table>");

说些什么

评论

最新文章

Post