what is the purpose of set.seed() and what does it mean. Can someone please explain with an example.
set.seed()
allows the selection of random numbers to be reproducible.
Example:
set.seed(123) # use any integer
runif(5) # 5 random numbers
runif(5) # different 5 random numbers
runif(5) # another different 5 random numbers
set.seed(123) # reset the seed
runif(5) # the original 5 random numbers
set.seed(321) # different seed
runif(5) # different random numbers
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.