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] a7 96 0e 97 9d 22 16 70 2a 04 09 bc b9 df 90 33 63 44 0b 6d 39 a9 e6 b3 30
#> [26] 2c 72 4b 7c 67 c3 bc
#>
#> [[2]]
#> [1] 40 bd 98 ce ed 9d b8 2f 91 cf 1d 1e 57 1d 9c 48 01 d1 f9 87 6c 24 5f 46 cf
#> [26] 32 c4 92 70 e9 a4 4b
#>
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_: 98 05 f3 e5 d4 fe ed dc cb b7 56 69 d8 d5 ed 90 19 93 c3 ...
#>
#> [[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_: 56 94 4f 6f 01 14 dd ef ff 4d d7 fa 9e 9c af e6 ee 3c a5 ...
#>