加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python random.shuffle的随机性

发布时间:2020-12-16 23:24:07 所属栏目:Python 来源:网络整理
导读:以下是来自 python网站,关于 random.shuffle(x[,random]) Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0,1.0) ; by default,this is the function random() . Note that for e
以下是来自 python网站,关于

random.shuffle(x[,random])

Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0,1.0); by default,this is the function random().

Note that for even rather small len(x),the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence can never be generated.

如果我想重复获得[‘a’…’k’]的随机排列,似乎随机播放不会给我随机性.我的理解是对的吗?

谢谢!

解决方法

You don’t have anything to worry about.在len(x)下,2000年以下,random.shuffle应该可以正常工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读