明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3262|回复: 21

[提问] 双色球号码如何生成

[复制链接]
发表于 2022-11-26 22:31:49 | 显示全部楼层 |阅读模式
看到本站的一个贴

http://bbs.mjtd.com/thread-186073-1-1.html

感觉是不真实的
因为一组双色球号码中是不能出现重复号码的
从标有 1-33 号的33个球中选出来的号码,怎么会有重复的?
我一时好奇
不知如何生成不重复的随机数?


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下

本帖被以下淘专辑推荐:

 楼主| 发表于 2022-11-26 22:38:57 | 显示全部楼层
本帖最后由 ynhh 于 2022-11-26 22:45 编辑

另外我发现



;;; 求随机数(0~1)--by 狂刀
(defun zzdatarnd ()                        ; 随机数种子
  (* (rem (getvar "cputicks") 1e3) 1e-3)
)
;;; 求n个a~b随机数列表----by 狂刀
(defun ssqmakerand-list        (a b n / c lst)        ; 随机数表
  (setq c (- b a))
  (repeat n
    (setq lst (cons (rtos (fix (+ a (* (zzdatarnd) c))) 2 0) lst))
  )
)

狂刀 大师 的这个随机数,感觉也是有问题,一直不会出现 a b 中的较大值


(ssqmakerand-list 1 5 30) = ("4" "1" "1" "3" "1" "3" "4" "2" "4" "1" "1" "3" "4" "3" "3" "1" "2" "3" "1" "1" "3" "1" "3" "1" "3" "4" "1" "2" "4" "4")

(ssqmakerand-list 10 16 30) = ("12" "14" "11" "12" "15" "11" "15" "10" "13" "10" "12" "13" "10" "12" "14" "11" "13" "10" "12" "10" "14" "15" "11" "13" "15" "11" "13" "12" "12" "14")

(ssqmakerand-list 7 2 30) = ("2" "3" "6" "5" "3" "6" "4" "2" "6" "6" "4" "2" "6" "5" "3" "2" "6" "5" "3" "6" "4" "2" "6" "4" "4" "3" "2" "2" "5" "5")

(ssqmakerand-list 12 3 30) = ("11" "7" "4" "8" "5" "9" "7" "6" "3" "7" "3" "10" "10" "9" "3" "9" "5" "11" "11" "8" "6" "8" "8" "3" "5" "4" "11" "10" "9" "11")

(ssqmakerand-list 1 33 100) = ("28" "9" "16" "29" "3" "17" "30" "14" "27" "2" "14" "21" "3" "8" "21" "29" "29" "6" "20" "30" "6" "13" "26" "1" "27" "5" "16" "29" "5" "19" "6" "6" "30" "4" "16" "5" "28" "15" "25" "22" "10" "30" "1" "28" "28" "23" "32" "4" "4" "29" "12" "7" "27" "10" "4" "5" "28" "3" "13" "26" "7" "18" "32" "11" "24" "3" "12" "20" "32" "10" "17" "27" "4" "26" "6" "14" "13" "30" "9" "17" "29" "18" "14" "24" "32" "8" "8" "21" "22" "12" "3" "17" "29" "19" "29" "20" "3" "26" "22" "25")


(ssqmakerand-list 33 1 100) = ("19" "9" "10" "26" "21" "11" "30" "17" "5" "23" "11" "32" "21" "7" "22" "14" "3" "27" "16" "8" "5" "26" "12" "30" "16" "7" "28" "26" "22" "6" "26" "13" "32" "22" "10" "10" "16" "4" "23" "21" "10" "28" "16" "23" "24" "10" "1" "26" "15" "5" "27" "29" "12" "31" "18" "15" "32" "20" "7" "10" "19" "5" "22" "19" "1" "21" "6" "2" "7" "24" "12" "8" "26" "19" "9" "1" "9" "1" "21" "17" "21" "10" "30" "16" "11" "8" "28" "23" "26" "31" "7" "8" "10" "25" "27" "24" "27" "20" "13" "18")












回复 支持 1 反对 0

使用道具 举报

发表于 2022-11-27 11:10:44 | 显示全部楼层
;| (ssqmakerand-list-NotSame 1 33 7)
(repeat 100
  (princ "\n")
  (princ (ssqmakerand-list-NotSame 1 33 7)))|;
(defun ssqmakerand-list-NotSame        (a b n / c lst x) ; 随机数表
  (defun rand () (* (rem (getvar "cputicks") 1e3) 1e-3))
  (setq        a1  (1- a)
        b1  (1+ b)
        c   (- b1 a1)
        lst '()
  )
  (while (< (length lst) n)
    (setq x (fix (+ a1 (* (rand) c))))
    (if        (and (not (member x lst)) (<= a x b))
      (setq lst (cons x lst))
    )
  )
)
回复 支持 1 反对 0

使用道具 举报

发表于 2022-11-27 01:03:34 | 显示全部楼层
本帖最后由 lee50310 于 2022-11-27 18:16 编辑



請參考 lee mac 樂透程式 lotto.lsp
可自設(1 - 49 號) 隨機產生6個號碼




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2022-11-27 09:13:36 | 显示全部楼层
楼主你在开奖号码下面画线,是不是没明白双色球的开奖规则。
发表于 2022-11-27 11:11:21 | 显示全部楼层
本帖最后由 lee50310 于 2022-11-27 16:21 编辑

利用 lee mac 所寫的 lotto.lsp

你可以自行改寫  由外部載入 17期大樂透.txt  文字檔資料
繪製成表格 並做每個球號出現次數的統計如 動態圖所示


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2022-11-27 11:28:23 | 显示全部楼层
改自leemac 双色球随机 特殊号码在最后一位

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2022-11-27 12:39:48 | 显示全部楼层
笨笨熊007 发表于 2022-11-27 11:28
改自leemac 双色球随机 特殊号码在最后一位

有点亮瞎眼,能发上来吗
发表于 2022-11-27 19:55:43 | 显示全部楼层

谢谢分享支持
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-16 02:28 , Processed in 0.207141 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表