lundi 26 septembre 2016

Find seed from previously-run code in R? How many possibilities are there?

I forgot to use set.seed myself in R and I'm trying to figure out what the seed was set to.

Anybody know how many possibilities there are?

I'm currently using the code below to generate 100 random values for each seed to check whether the list matches rand100, the 100 random values I'm trying to match.

t0= Sys.time()
for (i in 600000:1000000){

  set.seed(i)
  rand = runif(100,0,1)
  if (!(all.equal(rand100,rand) > 0)){
    print("match found!")
    print(i)
    break
  }

  t1= Sys.time()

  if(t1-t0>50){

    print("timeout")
    print(i)
    break
  }
}




Aucun commentaire:

Enregistrer un commentaire