Looping in pymc3/theano

I wouldn’t use scan for this, and generating random numbers is also not the right way.

I didn’t look too closely into what you want but I think this idea of generating a Gaussian random-walk might help:

pm.Normal('x', 0, sigma, shape=100).cumsum()

So you can just generate a vector that would be each initialization, and then e.g. sum the up to get random walk.