#### Parallel Processing for Setting Seed in R

I Have an `R` code that helps me to know at what `seed` when I use `arima.sim()` function to simulate `ARIMA(1, 0, 0)` it will actually simulate `ARIMA` of `order 1, 0, 0` when `auto.arima()` function is employed for a check.

MWE

``````library(forecast)
SEED_vector <- 1:10
arima_order_results <- data.frame()
flag <- TRUE
i <- 1
seed_out <- c()
while(flag){

set.seed(SEED_vector[i])
ar1 <- arima.sim(n = 20, model=list(ar=0.8, order = c(1, 0, 0)), sd = 1)
ar2 <- auto.arima(ar1, ic = "aicc")
if(all(arimaorder(ar2)==c(1,0,0))) {

#print(arima_order_results)
print(paste0('arimaorder', SEED_vector[i], ' ' ,
paste(arimaorder(ar2), collapse=" ")))
seed_out <- c(seed_out, SEED_vector[i])

}

arima_order = arimaorder(ar2)
arima_order = t(as.data.frame(arima_order))

arima_order_results = rbind(arima_order_results,arima_order)

i <- i+1
if(i == length(SEED_vector)) {

flag <- FALSE
}

}
``````

I am interested in what seed will I set such that when I run

``````set.seed(seed_out)
ar1 <- arima.sim(n = 20, model=list(ar=0.8, order = c(1, 0, 0)), sd = 1)
auto.arima(ar1, ic = "aicc")
``````

it will give me `arimaorder` of `(1, 0, 0). In my `MWE`the seeds are`2`and`3`.

What I want

I want this my `MWE` in `parallel processing` because I am actually running for seeds of 1 to 100,000 and it is taking 3 hours.

I am running `R` on windows

Source: Windows Questions