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

Ulrike Grömping groemp|ng @end|ng |rom beuth-hoch@chu|e@de
Thu May 9 18:43:01 CEST 2019


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.

Best, Ulrike

Am 09.05.2019 um 16:19 schrieb Duncan Murdoch:
> That is:  I'd expect this code to give identical results in both 
> versions, whether I used val <- 10 or any other value:
>
> val <- 10
> set.seed(val)
> rnorm(36)
>
> This code does not give identical results, because the calls to 
> sample() will result in different changes to the seed:
>
> val <- 10
> set.seed(val)
> discard <- sample(1000, 100)
> rnorm(36) 


-- 
##############################################
## Prof. Ulrike Groemping
## FB II
## Beuth University of Applied Sciences Berlin
##############################################
## prof.beuth-hochschule.de/groemping
## Phone: +49(0)30 4504 5127
## Fax:   +49(0)30 4504 66 5127
## Home office: +49(0)30 394 04 863
##############################################



More information about the R-package-devel mailing list