【发布时间】:2015-03-29 01:45:11
【问题描述】:
我运行以下代码:
np.random.RandomState(3)
idx1 = np.random.choice(range(20),(5,))
idx2 = np.random.choice(range(20),(5,))
np.random.RandomState(3)
idx1S = np.random.choice(range(20),(5,))
idx2S = np.random.choice(range(20),(5,))
我得到的输出如下:
idx1: array([ 2, 19, 19, 9, 4])
idx1S: array([ 2, 19, 19, 9, 4])
idx2: array([ 9, 2, 7, 10, 6])
idx2S: array([ 5, 16, 9, 11, 15])
idx1 和 idx1S 匹配,但 idx2 和 idx2S 不匹配。我希望一旦我为随机数生成器播种并重复相同的命令序列 - 它应该产生相同的随机数序列。这不是真的吗?还是我还缺少其他东西?
【问题讨论】: