使用量子整数作为其种子生成的随机数被认为是伪随机还是真正随机?

编程入门 行业动态 更新时间:2024-10-27 18:27:48
本文介绍了使用量子整数作为其种子生成的随机数被认为是伪随机还是真正随机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我总是听说量子计算机产生的随机数被认为是真正随机的",而经典计算机产生的随机数被认为是伪随机".

I always hear that random numbers produced by quantum computers are considered "truly random" while random numbers generated from a classical computer are considered "pseudo-random".

如果使用量子整数作为种子生成随机数,从该种子生成的数字是否会被视为伪随机"? 还是真正随机?在任何地方都找不到此说明,欢迎任何解释.

If one were to generate random numbers using a quantum integer as the seed, would the numbers generated from that seed be considered "pseudo-random" or truly random? Cannot find this clarification anywhere, any explanation welcome.

import random random.seed(get_my_quantum_number()) #Some quantum integer generated from an API. random.random() #Is this "pseudo-random" or "truly random" ?

推荐答案

random.random() 使用伪随机数生成器,它根据定义使用确定性算法并在数学上扩展其输入.因此,它生成的数字是伪随机的,即使它是由量子随机数生成器或其他一些非确定性源的输出播种的.另请参阅以下问题:

random.random() uses a pseudorandom number generator, which uses a deterministic algorithm by definition and mathematically expands its input. Thus, the numbers it generates are pseudorandom, even if it was seeded by the output of a quantum random number generator or some other nondeterministic source. See also these questions:

  • 随机函数(在任何编程语言中)是否有偏见?
  • 如何获得真正的随机数据,而不是像 CSRNG 那样将随机数据输入到 PRNG 种子中?

无论如何,伪随机"之间的区别不言而喻.和真正随机"数字不是应用程序关心的(并且您并没有真正指定您想到的应用程序类型).相反,一般来说:

In any case, the distinction between "pseudorandom" and "truly random" numbers is not what applications care about (and you didn't really specify what kind of application you have in mind). Instead, in general:

  • 安全应用程序关心数字是否难以猜测;在这种情况下,只有加密 RNG 才能满足这一要求(即使是依赖于伪随机数生成器的).Python 示例是 secrets 模块或 random.SystemRandom.
  • 科学模拟关心数字的行为是否像独立的均匀随机数,并且通常关心这些数字在以后是否可重现.Python 示例是 numpy.random.Generator.
  • Security applications care whether the numbers are hard to guess; in this case, only a cryptographic RNG can achieve this requirement (even one that relies on a pseudorandom number generator). A Python example is the secrets module or random.SystemRandom.
  • Scientific simulations care whether the numbers behave like independent uniform random numbers, and often care whether the numbers are reproducible at a later time. A Python example is numpy.random.Generator.

例如,random.random() 使用的伪随机数生成器,Mersenne Twister,不适用于密码学或信息安全;它生成的数字并非设计为难以猜测,无论该生成器是如何播种的(无论是通过量子随机数生成器还是其他方式),情况都是如此.

For example, the pseudorandom number generator used by random.random(), Mersenne Twister, is not suitable for cryptography or information security; the numbers it produces are not designed to be hard to guess, and this is the case no matter how that generator was seeded (whether by a quantum random number generator or otherwise).

更多推荐

使用量子整数作为其种子生成的随机数被认为是伪随机还是真正随机?

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

发布评论

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

>www.elefans.com

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