跨平台numpy.random.seed()

2024-04-25 13:08:52 发布

您现在位置:Python中文网/ 问答频道 /正文

docs说:

Compatibility Guarantee A fixed seed and a fixed series of calls to ‘RandomState’ methods using the same parameters will always produce the same results up to roundoff error except when the values were incorrect. Incorrect values will be fixed and the NumPy version in which the fix was made will be noted in the relevant docstring. Extension of existing parameter ranges and the addition of new parameters is allowed as long the previous behavior remains unchanged.

没有提到操作系统。在

如果我在windows和linux上调用np.random.seed(42),那么之后生成的随机数会相同吗? 在64位Ubuntu的不同版本中会是一样的吗?在

我假设rng使用系统库,因此代码可能不可移植。如果这是真的,有解决办法吗?我知道这可能很难看,就像改变linuxrng系统来模拟windows一样。但我已经准备好了创造性的解决方案。在


Tags: andofthetoindocswindows系统