简体   繁体   English

numpy.random.seed 是否使结果固定在不同的计算机上?

[英]Does numpy.random.seed make results fixed on different computers?

I know that when you use numpy.random.seed(0) you get the same result on your own computer every time.我知道当您使用numpy.random.seed(0)时,您每次在自己的计算机上都会得到相同的结果。 I am wondering if it is also true for different computers and different installations of numpy.我想知道对于不同的计算机和 numpy 的不同安装是否也是如此。

It all depends upon type of algorithm implemented internally by numpy random function .这完全取决于numpy random function内部实现的algorithm类型。 In case of numpy , which is operated by pseudo-random number generators (PRNGs) algorithm.numpy的情况下,它由pseudo-random number generators (PRNG) 算法操作。 What this means is that if you provide the same seed( as of starting input ), you will get the same output.这意味着如果您提供相同的种子(从开始输入开始),您将获得相同的 output。 And if you change the seed, you will get a different output.如果你改变种子,你会得到一个不同的output。 So this kind of algorithm is no system dependent.所以这种算法不依赖于系统。

But for a true random number generator (TRNG) these often rely on some kind of specialized hardware that does some physical measurement of something unpredictable in the environment such as light or temperature electrical noise radioactive material.但是对于true random number generator (TRNG) ,这些通常依赖于某种专门的硬件,这些硬件对环境中不可预测的事物进行一些物理测量,例如光或温度、电噪声、放射性物质。 So if an module implements t his kind of algorithm then it will be system dependent.因此,如果一个模块实现了这种算法,那么它将取决于系统。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM