0

I want to model wiener process and I want to add some implementation of elementary result, so I want to write something like this:

# w is elementary result
def W(T, w = 0, dt = 0.001):
    x = [0]
    for t in np.arange(0, T, dt):
        x.append(x[-1] + np.random.normal(0,dt, w))
    return x

and I expect that with same w I got same output of W. But np.random.normal doesn't support such thing. How can I implement it?

Nourless
  • 729
  • 1
  • 5
  • 18

1 Answers1

0

Maybe clarity on how set seed works.

import numpy as np

np.random.seed(0)
np.random.normal(0,0.001,1)
>> array([0.00176405]) #My output
np.random.normal(0,0.001,1)
>>array([0.00040016])

np.random.seed(0)
np.random.normal(0,0.001,1)
>> array([0.00176405]) #Same output
np.random.normal(0,0.001,1)
>>array([0.00040016])

Every time you want the same results, you have to reset the seed again.

Jason Chia
  • 1,144
  • 1
  • 5
  • 18