How to replicate 100 times an RBC model?

See [N stochastic simulations for a number of periods T)
Negative values should not be an issue unless you take logs of these values and I don’t see why you are doing this.