[R-pkg-devel] Change in normal random numbers between R 3.5.3 and R 3.6.0

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Thu May 9 19:45:46 CEST 2019


On 09/05/2019 12:43 p.m., Ulrike Grömping wrote:
> Hmmmh, but does that also apply if the sample.kind has been set to the
> old version? I.e., would
> 
> if (getRversion()>="3.6.0") RNGkind(sample.kind="Rounding")
> val <- 10
> set.seed(val)
> discard <- sample(1000, 100)
> rnorm(36)
> 
> produce the same normal random numbers in 3.5.3 and 3.6.0? I would have
> expected it to, but it seems to produce the same normal random numbers
> as R version 3.6.0 in the previous version of the test code without the
> RNGkind call.
> 

I'm not seeing that, but I'm not using the exact versions you tested. 
If I run your code in  "R version 3.5.2 (2018-12-20)" and "R Under 
development (unstable) (2019-05-02 r76454)" I get this output from both:

 > if (getRversion()>="3.6.0") RNGkind(sample.kind="Rounding")
 > val <- 10
 > set.seed(val)
 > discard <- sample(1000, 100)
 > rnorm(36)
  [1] -0.4006375 -0.3345566  1.3679540  2.1377671  0.5058193  0.7863424 
-0.9022119  0.5328970 -0.6458943  0.2909875 -1.2375945
[12] -0.4561763 -0.8303227  0.3401156  1.0663764  1.2161258  0.7356907 
-0.4812086  0.5627448 -1.2463197  0.3809222 -1.4304273
[23] -1.0484455 -0.2185036 -1.4899362  1.1727063 -1.4798270 -0.4303878 
-1.0516386  1.5225863  0.5928281 -0.2226615  0.7128943
[34]  0.7166008  0.4402419  0.1588306

Okay, I just installed 3.6.0, and I get the same values there.  I don't 
see a Mac binary for 3.5.3, so I can't test that one.

Duncan Murdoch



More information about the R-package-devel mailing list