Skip to Content

How to use the double foreach loop of the R-package doRNG?

I am using foreach-dorng for a fixed random seed on R.

library(foreach)
a<-foreach(j=1:2,combine=rbind) %:% 
     foreach(i=1:2,combine=cbind) %do% { rnorm(5) }
 
a<-foreach(j=1:2,combine=rbind) %:% 
     foreach(i=1:2,combine=cbind) %dopar% { rnorm(5) }

Those are working well. But the below is not working.

library(doRNG)
a<-foreach(j=1:2,combine=rbind) %:% 
     foreach(i=1:2,combine=cbind) %dorng% { rnorm(5) }

Can I use the dorng in the double foreach?

Thank you,