Skip to content
Discussion options

You must be logged in to vote

Thanks for asking - and doubly so as it led me to find a subtle bug (#509).

So try this after installing the dev version of mirai using e.g.:

pak::pak("r-lib/mirai")

As parallel seeds work fundamentally differently to normal seeds, I suggest setting synchronous daemons with the same seed value rather than try to replicate what happens on a daemon in the main session (although that is also possible).

library(mirai)
library(purrr)
library(testthat)

seed <- 12

daemons(sync = TRUE, seed = seed)
daemons_0 <- map(1:4, in_parallel(function(i) { rnorm(3) }))

daemons(2, seed = seed)
daemons_2 <- map(1:4, in_parallel(function(i) { rnorm(3) }))

expect_equal(daemons_0, daemons_2)

When you specify s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eli-daniels
Comment options

Answer selected by eli-daniels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants