模拟双色球摇号

发布时间 2023-03-23 15:10:56作者: 你若愿意,我一定去

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>双色球摇号</title>
</head>
<body>
<script>
    const qiu = [];

    function pro() {
        let qs = [];
        // 生产6个红球
        while (qs.length < 6) {
            const q = Math.ceil(Math.random() * 33);
            if (!qs.includes(q)) {
                qs.push(q);
            }
        }
        qs.sort((a, b) => a - b);
        // 生成1个蓝球
        const q = Math.ceil(Math.random() * 16);
        qs.push(q);
        return qs;
    }
    // 生成五注
    for (var i = 0; i < 5; i++) {
        const one = pro();
        console.log(`%c${one.slice(0,6).join(',')}-%c${one[6]}`, 'color: red', 'color: blue');
    }

    // console.log(pro());


</script>
</body>
</html>