I am generating random entries at selected positions in a matrix and I would like to see the same entries over different runs of the code. So I did the following but I'm not sure what I did wrong to get different entries on each run?
import numpy as np
import random
random.seed(10)
N = 5
G = [[0 for i in np.arange(N)] for j in np.arange(N)]
for i in np.arange(N):
for j in np.arange(N):
if i==j:
G[i][j] = 0
else:
if abs(i-j) <= 2:
random.seed(10)
G[i][j] = round(np.random.uniform(0,1),2)
else:
G[i][j] = 0
print(G)
randompackage, but you called NumPy's RNG instead. You didn't touch that seed.