[Bioc-devel] loading database package changes random number

Steffi Grote @te|||_grote @end|ng |rom ev@@mpg@de
Thu Apr 11 16:17:16 CEST 2019


Hi all,
I found out that example code for my package GOfuncR yields a different result the first time it's executed, despite setting a seed. All the following executions are identical.
It turned out that loading the database package 'Homo.sapiens' changed the random numbers:

set.seed(123)
runif(1)
# [1] 0.2875775

set.seed(123)
suppressWarnings(suppressMessages(require(Homo.sapiens)))
runif(1)
# [1] 0.7883051

set.seed(123)
runif(1)
# [1] 0.2875775

Is that known or expected behaviour?
Should I not load a package inside a function that later uses random numbers?

Thanks in advance,
Steffi



More information about the Bioc-devel mailing list