我可以用python生成真实的随机数吗?

编程入门 行业动态 更新时间:2024-10-25 16:24:39
本文介绍了我可以用python生成真实的随机数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在学习 python 的随机模块.而且我知道它会生成伪随机数.它的核心思想是用一个高频时钟作为种子,然后用一个函数产生一个看起来像随机数".

I'm learning random module of python. And I know it generates pseudo random number. Which its core idea is to use a high-frequency clock as a seed and then use a function to produce a 'looking-like random number.

据我所知,在现实世界中甚至不可能产生真正的随机数.

As I know it's even impossible to produce authentic random number in the real world.

但我知道Unix随机生成器引入了一些其他因素,例如鼠标移动轨迹参数,IO响应时间,为其随机数生成器函数引入不确定性.通过它我们可以获得比普通伪随机数更好的随机数.预测要困难得多.

But I know Unix random producer has introduced some other factors such as the parameter of mouse-movement track, the IO response time, to introduce uncertainty to its random number producer function. Through which we can get a better random number than normal pseudo random number. It's much more harder to predict.

那么,有没有办法在python中我们可以产生这样的随机数,或者导入一个好的第三方库?

So, is there a way that in python we can produce such a random number, or maybe import a good third party library?

推荐答案

random 模块的 >documentation 是这样说的:

The documentation for the random module has this to say:

警告:不应出于安全目的使用此模块的伪随机生成器.如果您需要加密安全的伪随机数生成器,请使用 os.urandom() 或 SystemRandom.

Warning: The pseudo-random generators of this module should not be used for security purposes. Use os.urandom() or SystemRandom if you require a cryptographically secure pseudo-random number generator.

更多推荐

我可以用python生成真实的随机数吗?

本文发布于:2023-11-30 21:12:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651488.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:随机数   可以用   真实   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!