【发布时间】:2016-11-18 11:39:50
【问题描述】:
docs 说:
兼容性保证一个固定的种子和一系列固定的调用 使用相同参数的“RandomState”方法总是会产生 舍入误差的结果相同,除非值是 不正确。不正确的值将被修复,NumPy 版本在 所做的修复将在相关文档字符串中注明。 扩展现有参数范围并添加新参数 只要之前的行为保持不变,就允许使用参数。
没有提到操作系统。
如果我在windows和linux上调用np.random.seed(42),之后生成的随机数会一样吗?
不同版本的 64 位 Ubuntu 会不会一样?
我假设 rng 使用系统库,因此代码可能不可移植。如果是真的,有解决办法吗?我知道这可能很难看,就像将 linux rng 系统更改为模拟 Windows 的东西一样。但我已经准备好接受创造性的解决方案了。
【问题讨论】:
-
开始阅读this discussion。摘录:
Also, IIRC, numpy.random has unit tests that check that the random numbers that are generated are platform independent, and the same across versions. (there was a mess, when Enthought once changed the random number generator for the normal distribution, that triggered the addition of those unit tests.)
标签: python linux windows numpy random