Skip to contents

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.

Usage

monty_rng_distributed_state(
  seed = NULL,
  n_streams = 1L,
  n_nodes = 1L,
  algorithm = "xoshiro256plus"
)

monty_rng_distributed_pointer(
  seed = NULL,
  n_streams = 1L,
  n_nodes = 1L,
  algorithm = "xoshiro256plus"
)

Arguments

seed

Initial seed to use. As for monty_rng, this can be NULL (create a seed using R's generators), an integer or a raw vector of appropriate length.

n_streams

The number of streams to create per node.

n_nodes

The number of separate seeds to create. Each will be separated by a "long jump" for your generator.

algorithm

The name of an algorithm to use.

Value

A list of either raw vectors (for monty_rng_distributed_state) or of monty_rng_pointer objects (for monty_rng_distributed_pointer)

Details

See vignette("rng_distributed") for a proper introduction to these functions.

Examples

monty::monty_rng_distributed_state(n_nodes = 2)
#> [[1]]
#>  [1] 7e 59 2a a1 81 a5 94 06 df 64 0b 54 60 54 c3 39 81 84 b1 c2 1f 13 fb ea 15
#> [26] 36 86 cb 15 fd bf b4
#> 
#> [[2]]
#>  [1] d5 b6 80 48 d2 d0 59 b0 85 02 d5 ac 19 94 21 5e fe f4 54 0c bd eb 10 ac 8e
#> [26] fe 80 7f bb e7 0f 05
#> 
monty::monty_rng_distributed_pointer(n_nodes = 2)
#> [[1]]
#> <monty_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_: aa 5a aa 44 48 f9 4a 7d 76 c2 a8 5a e5 51 aa 85 be 40 ea ...
#> 
#> [[2]]
#> <monty_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_: 91 d9 e4 1f 37 33 85 08 04 d3 36 e0 55 91 8e fc 1e bc 75 ...
#>