Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current seed in R

Tags:

random

r

I am running a function with random factor in R, and I realized that I forgot to run set.seed() before running this function.

Is there a way I can retrieve the seed value R is using (I suppose it will be an arbitrary number, but doesn't matter) so I can reproduce the execution?

like image 666
mamatv Avatar asked Sep 27 '22 05:09

mamatv


1 Answers

You can get the current random state using .Random.seed. However, you'd need the previous state for reproducing your results and it's not possible to get that.

(Well, the Mersenne Twister is not cryptographically secure, so maybe it could be possible, but certainly not practical.)

like image 101
Roland Avatar answered Sep 28 '22 19:09

Roland