I am using R to construct an agent based model with a monte carlo process. This means I got many functions that use a random engine of some kind. In order to get reproducibl
I suggest that you set.seed
before calling each random number generator in R. I think what you need is reproducibility for Monte Carlo simulations. If in a for
loop, you can set.seed(i)
before calling sample
, which guarantees to be fully reproducible. In your outer function, you may specify an argument seed=1
so that in the for
loop, you use set.seed(i+seed)
.