为什么垃圾值不能充当随机数? [英] Why garbage value cannot act as random number?

查看:53
本文介绍了为什么垃圾值不能充当随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能不是针对特定语言的.

This question may not be language specific.

  • 是否可以创建一个真正的随机数?
  • 如果不是为什么随机数生成必须经过某种算法,为什么垃圾值不能充当随机数.

推荐答案

可以.取决于您对随机数的定义:

It can. Depending on your definition of a random number:


(来源:dilbert.com)

在大多数应用程序中,您期望随机数生成器生成一系列均匀分布的数字.垃圾值不提供此特性.

In most applications, what you expect from a random number generator is to generate a sequence of numbers that are uniformly distributed. A garbage value does not provide this characteristic.

是否可以创建一个真正的随机数?

Is it possible to create a true random number?

如果您将真正随机"定义为不可预测,那么问题是什么原因不可预测?"

If you define "truly random" as unpredictable, the question is "unpredictable by what?"

密码安全(伪)随机数生成器试图隐藏状态用户级代码的随机数生成器,也就是说,理想情况下,只有内核模式代码才能可行地预测下一个随机数.

There are cryptographically secure (pseudo-)random number generators that try to hide the state of the random number generator from user-level code, that is, ideally, only kernel mode code can feasibly predict the next random number.

然而,一个孤立的计算机系统(没有任何外部输入)是一个确定性的有限状态机.也就是说,通过了解机器的当前状态,您可以总是预测下一个状态.所以,如果你的意思是软件系统一般来说不可预测",不,你不能根据这个定义使用确定性系统来生成真正的随机性".

However, an isolated computer system (without any external input) is a deterministic finite state machine. That is, by knowing the current state of the machine, you can always predict the next state. So, if you mean "unpredictable" by a software system in general, no, you can't use a deterministic system to generate "true randomness" according to this definition.

还有另一种更具哲学意义的不可预测性.即使依靠外部输入(如大气噪声或其他方式),它们真的不可预测吗?有人可能会争辩说,我们生活在一个确定性的世界中,就像一台数字计算机,一切都注定要发生;所以,没有随机性.我没有答案.

There's another kind of unpredictability that is more philosophical. Even if you rely on external input (such as atmospheric noise or other means), are they really unpredictable? One might argue that we live in a deterministic world and like a digital computer, everything is determined to happen; so, there's no randomness. I don't have an answer for that.

这篇关于为什么垃圾值不能充当随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆