3

Issue: On R, running the function below leads to different seeds generation (and different set of random number) on 2 different machines but with the same starting seed with Mersenne-Twister algorithm:

  • one on laptop on a docker container;
  • one on an aws instance on a docker container. R is called from RPY2

Apart from that, everything is the same between the 2 environments:

  • docker image is the same: image docker: rpy2/base-ubuntu:master-20.04
  • R version is the same: R version 3.6.3 (2020-02-29)
function(seed) {
    RNGkind("Mersenne-Twister")
    set.seed(seed)
    LogSystem(Logger, "INFO", "Seed value:")
    LogSystem(Logger, "INFO", as.character(seed))
    LogSystem(Logger, "INFO", ".Random.seed:")
    LogSystem(Logger, "INFO", as.character(
      paste(as.character(.Random.seed[1:5]), collapse = " ")
    ))
    s <- as.integer(floor(runif(n = 100,min=1,max=2147483647)))
  }

Below the results of the logs for the 2 environments:

Laptop:

version:
x86_64-pc-linux-gnu
x86_64
linux-gnu
x86_64, linux-gnu
3
6.3
2020
02
29
77875
R
version 3.6.3 (2020-02-29)
Holding the Windsock

Seed value:
875241372
.Random.seed:
10403 624 -571619272 -1832112935 413134534

Aws instance

version:
x86_64-pc-linux-gnu
x86_64
linux-gnu
x86_64, linux-gnu
3
6.3
2020
02
29
77875
R
R version 3.6.3 (2020-02-29)
Holding the Windsock
Seed value:
875241372
.Random.seed:
10403 624 -169270483 -442010614 -603558397

Any idea what could lead to different seeds generation between two environments with the same OS, same R version ?

EDIT: On AWS, R is called from Rpy2

Florimond
  • 31
  • 2

0 Answers0