On Tuesday, July 15, 2014 5:25:11 PM UTC-5, Gray Calhoun wrote: > Hi everyone, I'm trying to start using Julia for some Monte > Carlo simulations (not MCMC) which I'd like to parallelize. I > haven't found any documentation for setting the RNG's seed for > parallelization. The naive approach gives different results > than non-parallel execution (which is not surprising). [rest of message cut]
Thanks to everyone who replied to my original email. Just to follow up, it turns out that `pmap` gives a simple solution, since it manages the parallel tasks from the main process. The following code gives the general idea: ``` addprocs(1) srand(1) function rvproducer() for i=1:4 produce(rand()) end end parallelrvs = pmap(Task(rvproducer)) do x println(x) ## verify that the work is done on different processes return x end srand(1) sort(parallelrvs) == sort(rand(4)) ## returns true ``` --Gray