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] 22 a8 ac 52 20 b1 43 d8 2b e5 c3 26 17 1b b0 7a 81 b0 17 3d 6b 2b cf 75 ed
#> [26] 16 7d d4 1d 47 ae 07
#> 
#> [[2]]
#>  [1] 55 69 d3 7d c7 28 ae e9 29 d4 12 8a 04 da 6a 57 fb 09 d9 3f d9 65 9d 31 4e
#> [26] db 4b c8 88 28 e2 28
#> 
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_: 83 6f a7 81 a1 dc 69 f1 90 00 81 d1 88 22 c9 fb 5c 8b 95 ...
#> 
#> [[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_: 58 c2 bd fe cb 52 7c ae 16 f9 bc 6a ea 67 89 e6 cf ce 7e ...
#>