1

So I need to generate two samples. First with numbers 1:20 and second with letters. Also I need to impose set.seed(444) random generator but only on first sample with numbers, the second one should not use it. How can I use set.seed() only for the first one and avoid affecting my second sample by it?

set.seed(444)
x <-sample(1:20, 20, replace = F)  ## this one with set.seed()
y <-sample(letters, 20, replace=F) ## this one without set.seed()
thelatemail
  • 91,185
  • 12
  • 128
  • 188
andrzej541
  • 919
  • 1
  • 9
  • 21

1 Answers1

3

You can set.seed with NULL

set.seed(444)
x <-sample(1:20, 20, replace = F) 
set.seed(NULL)
y <-sample(letters, 20, replace=F) 
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213