R: bizarre behavior of set.seed()

前端 未结 2 1140
旧巷少年郎
旧巷少年郎 2021-01-04 21:08

Odd thing happens when in R when I do set.seed(0) and set.seed(1);

set.seed(0)
sample(1:100,size=10,replace=TRUE)
#### [1] 90 27 38 58 91 21 90 95 67 63


se         


        
2条回答
  •  醉酒成梦
    2021-01-04 21:15

    As you can see from the other answer, seeds 0 and 1 result in almost similar initial states. In addition, Mersenne Twister PRNG has a severe limitation - "almost similar initial states will take a long time to diverge"

    It is therefore advisable to use alternatives like WELL PRNG (which can be found in randtoolbox package)

提交回复
热议问题