My R script calls sub-functions which contains set.seed(). What is the scope of the set.seed()? Will it also affect to main program that calls it?
More specificly
# main program
callsubfun()
... some statement ...
sample.int(100,20)
# sub function
callsubfun <- function(x,y,...){
set.seed(100)
... do the work ...
return(something)
}
set.seed()
is 'global'. It has the potential for ruining your pseudo-randomness.