which RNGversion am I using

Viewed 351

I know that I can set the RNGversion with e.g.

RNGversion("3.5.2")

but is it possible to query R for which version i am currently using?

EDIT:

my problem is that something changed around version 3.6.0 which is not visible in RNGkind()

e.g

library(magrittr)

RNGversion("3.5.2")
RNGkind()
set.seed(1)
tibble::tibble(A = 1:5000) %>% 
  dplyr::sample_n(2)

yields:

> "Mersenne-Twister" "Inversion"        "Rounding"
> # A tibble: 2 x 1
     A
 <int>
  1328
  1861

but:

RNGversion("4.0.2")
RNGkind()
set.seed(1)
tibble::tibble(A = 1:5000) %>% 
  dplyr::sample_n(2)

yields

> "Mersenne-Twister" "Inversion"        "Rejection"
> # A tibble: 2 x 1
  A
  <int>
1  1017
2  4775

both pieces of code returns a reproducible output, but different, even though RNGkind() returns the same thing. Hence I want to know the RNGvesion()

EDIT 2: I somehow missed the difference in the 3 element of the outputs of RNGkind() for the two different version.

1 Answers

Studying the source code of RNGversion is elucidating.

getRversion()
#[1] ‘4.0.2’
RNGkind()
#[1] "Mersenne-Twister" "Inversion"        "Rejection" 

#pre 3.6
RNGversion("3.5")
RNGkind()
#[1] "Mersenne-Twister" "Inversion"        "Rounding" 

#pre 1.7
RNGversion("1.6")
RNGkind()
#[1] "Marsaglia-Multicarry"   "Buggy Kinderman-Ramage" "Rounding"

#pre 0.99
RNGversion("0.90")
RNGkind()
#[1] "Wichmann-Hill"          "Buggy Kinderman-Ramage" "Rounding"

You need to write your own function if you want to get version ranges depending on the RNGkind output.

Related