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] 85 65 3c 51 f9 83 8d ed b3 b5 a8 70 d3 52 db 15 42 4d e9 ff 8f bc 47 32 4d
#> [26] 68 67 00 c5 d7 67 1b
#> 
#> [[2]]
#>  [1] 42 e3 9e a6 31 8f 8b 0a 43 73 11 df 03 28 c0 bd b4 0d 31 d2 79 4e f3 9e 67
#> [26] 36 d6 9c 46 76 02 fd
#> 
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_: 8b 2b 74 9c 7c 3c b7 db 08 01 03 7a d0 a2 ef d7 00 c0 1c ...
#> 
#> [[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_: 54 29 8a 37 36 e8 86 3e 41 c5 3b 05 7d f9 2d e2 f6 20 e3 ...
#>