Create a set of initial random number seeds suitable for using within a distributed context (over multiple processes or nodes) at a level higher than a single group of synchronised threads.
dust_rng_distributed_state(
seed = NULL,
n_streams = 1L,
n_nodes = 1L,
algorithm = "xoshiro256plus"
)
dust_rng_distributed_pointer(
seed = NULL,
n_streams = 1L,
n_nodes = 1L,
algorithm = "xoshiro256plus"
)
Initial seed to use. As for dust_rng, this can
be NULL
(create a seed using R's generators), an integer or a
raw vector of appropriate length.
The number of streams to create per node. If
passing the results of this seed to a dust object's initialiser
(see dust_generator) you can safely leave this at 1, but
if using in a standalone setting, and especially if using
dust_rng_distributed_pointer
, you may need to set this to the
appropriate length.
The number of separate seeds to create. Each will be separated by a "long jump" for your generator.
The name of an algorithm to use. Alternatively
pass a dust_generator
or dust
object here to select the
algorithm used by that object automatically.
A list of either raw vectors (for
dust_rng_distributed_state
) or of dust_rng_pointer
objects (for dust_rng_distributed_pointer
)
See vignette("rng_distributed")
for a proper introduction to
these functions.
dust::dust_rng_distributed_state(n_nodes = 2)
#> [[1]]
#> [1] 8c 00 3b 9b 5a 05 bc d1 87 ac 44 56 33 e5 e3 d3 ee 2e 0d 29 3d db 3c 63 ee
#> [26] ee 9a ca d2 ec 65 19
#>
#> [[2]]
#> [1] 7e c3 6d 78 21 d9 6c d1 3c e4 ba 1a fe dd ae 66 34 45 0a 53 b2 56 50 a7 c6
#> [26] 31 36 2d b6 2f eb 9f
#>
dust::dust_rng_distributed_pointer(n_nodes = 2)
#> [[1]]
#> <dust_rng_pointer>
#> Public:
#> algorithm: xoshiro256plus
#> initialize: function (seed = NULL, n_streams = 1L, long_jump = 0L, algorithm = "xoshiro256plus")
#> is_current: function ()
#> n_streams: 1
#> state: function ()
#> sync: function ()
#> Private:
#> is_current_: TRUE
#> ptr_: externalptr
#> state_: f1 4a 1e 85 56 02 60 84 e2 e8 a5 fd e4 6a 49 43 80 84 38 ...
#>
#> [[2]]
#> <dust_rng_pointer>
#> Public:
#> algorithm: xoshiro256plus
#> initialize: function (seed = NULL, n_streams = 1L, long_jump = 0L, algorithm = "xoshiro256plus")
#> is_current: function ()
#> n_streams: 1
#> state: function ()
#> sync: function ()
#> Private:
#> is_current_: TRUE
#> ptr_: externalptr
#> state_: e9 31 30 b6 4e 53 d0 64 68 df 07 aa 94 94 85 36 a4 40 13 ...
#>