SOURCE

function randomInt(a, b) {
    return function() {
        return a + Math.floor(Math.random() * (b - a + 1));
    }
}

const redFn = randomInt(1, 33);
const blue = randomInt(1, 16);
const redSize = 6;
function ball() {
    const result = [];
    for (let i = 0; i < redSize; i++) {
        result.push(redFn());
    }
    result.push(blue());
}

console.log(ball());

redFn();
blue();
console 命令行工具 X clear

                    
>
console