title: seed object for reproducible results in parallel operation in caret
body: <p>I am trying to use code for fully reproducible parallel models in caret but do not understand how to set the size of the vectors in the seed object.  For gbm I have 4 tuning parameters with a total of 11 different levels, and I have 54 rows in my tuning grid.  If I specify any value &lt; 18 as the last value in the "for(i in 1:10)" line below, I get an error: "Bad seeds: the seed object should be a list of length 11 with 10 integer vectors of size 18 and the last list element having a single integer."  Why 18?  Also it runs without errors for values > 18 (e.g., 54) - why?  Many thanks for the help.  The following is based on <a href="http://topepo.github.io/caret/training.html" rel="nofollow">http://topepo.github.io/caret/training.html</a>, added some things.</p>
  
  <pre><code>library(mlbench)
  data(Sonar)
  str(Sonar[, 1:10])
  library(caret)
  library(doParallel)
  
  set.seed(998)
  inTraining &lt;- createDataPartition(Sonar$Class, p = .75, list = FALSE)
  training &lt;- Sonar[ inTraining,]
  testing  &lt;- Sonar[-inTraining,]
  
  grid &lt;- expand.grid(n.trees = seq(50,150,by=50), interaction.depth = seq(1,3,by=1),
    shrinkage = seq(.09,.11,by=.01),n.minobsinnode=seq(8,10,by=2)) 
  
  # set seed to run fully reproducible model in parallel mode using caret          
  set.seed(825)
  seeds &lt;- vector(mode = "list", length = 11) # length is = (n_repeats*nresampling)+1
  for(i in 1:10) seeds[[i]]&lt;- sample.int(n=1000, 11) # ...the number of tuning parameter...
  seeds[[11]]&lt;-sample.int(1000, 1) # for the last model
  
  fitControl &lt;- trainControl(method = "cv",number = 10,seeds=seeds)               
  
  # run model in parallel
  cl &lt;- makeCluster(detectCores())
  registerDoParallel(cl)
  
  gbmFit1 &lt;- train(Class ~ ., data = training,method = "gbm",
    trControl = fitControl,tuneGrid=grid,verbose = FALSE)
  gbmFit1
  </code></pre>