BondedDust answer is OK, but not always Ouch!
You can use set.seed () to reproduce the algorithm. that is, everyone can reproduce your results.
I recommend you use set.seed if you want to share your code. For example, if you need help with stackoverflow, we could accurately reproduce your code.
set.seed(123) rand<-rnorm(10) plot(density(rand))
If you use another seed, you get different results.
set.seed(234) rand<-rnorm(10) plot(density(rand))
Both are correct, but it would be easier to help you if the seed were known. By the way, just use set.seed once in your routine, because you can generate a dependency in your random numbers. We want independent random numbers in the simulation.
user3953420
source share