用真正的随机数播种一个随机数生成器以获得真正的随机数? [英] Seed a random number generator with a real random number to get real random numbers?

查看:60
本文介绍了用真正的随机数播种一个随机数生成器以获得真正的随机数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个笼统的问题,并非特定于编程语言.

This is a general question, and not specific to a programming language.

如果我使用随机数生成器(例如 Java 中的 Math.Random()),则数字并不是真正随机的.一个常见的做法是用本地系统时间来播种数字,以便在每次程序执行时得到随机数.

If I use a random number generator (e.g. Math.Random() in Java), the Numbers are not really random. A common practice is to seed the numbers with the local system time to get random numbers every time the program is executed.

现在,如果您使用一个非常随机的数字(例如来自 random.org)进行播种会怎样.你得到的数字也会是真正的随机数吗?

Now what if you seed with a really random number (for example from random.org). Will the numbers you get be real random numbers too?

推荐答案

没有

将单个数字称为随机"与否没有意义.序列是或不是随机的.无论您如何播种 PRNG,序列都是确定性的,因此不是真正随机的.

It is not meaningful to speak of individual numbers as "random" or not. It is the sequence that is or is not random. No matter how you seed a PRNG, the sequence will be deterministic and therefore not truly random.

然而,这是为不需要加密安全性(如模拟和蒙特卡罗集成)的用途播种 PRNG 的最佳方式,因此这是一个非常好的做法.理想情况下,您希望为 PRNG 设置与 PRNG 内部状态大小一样多的真正随机位.

It is, however, the best way to seed a PRNG for uses that don't require cryptographic security like simulations and Monte Carlo integration, so it is a very good practice. Ideally, you want to seed the PRNG with as many truly random bits as the size of the PRNG's internal state.

这篇关于用真正的随机数播种一个随机数生成器以获得真正的随机数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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