Position of numpy random seed

I have the following code for running an autoregressive process:

import numpy as np



 def AR1(mu,phi,x0, Nt, a, b, neg = False):


    AR_1 = []

    x1 = np.zeros(len(x0))

    #np.random.seed(0)


    for j in range(Nt):
        #np.random.seed(0)
        for i in range(len(x0)):   
            x1[i] = mu[i] + phi*(x0[i] - mu[i]) + ss.truncnorm.rvs(a[i],b[i])  

        AR_1.append(x1)
        x0 = x1.copy()
        x1 = np.zeros(len(x0))

    return AR_1

As you can see I have a couple of positions where I might put np.random.seed(0). I want the same set of random numbers to be chosen for every run so that I can see the effect of varying phi. With this in mind, where should i place np.random.seed in the code? Thanks!

1 answer