This function exists to support use from other
packages that wish to use dust's random number support, and
creates an opaque pointer to a set of random number streams. It
is described more fully in vignette("rng_package.Rmd")
algorithm
The name of the generator algorithm used (read-only)
n_streams
The number of streams of random numbers provided (read-only)
new()
Create a new dust_rng_pointer
object
dust_rng_pointer$new(
seed = NULL,
n_streams = 1L,
long_jump = 0L,
algorithm = "xoshiro256plus"
)
seed
The random number seed to use (see dust_rng for details)
n_streams
The number of independent random number streams to create
long_jump
Optionally an integer indicating how many "long jumps" should be carried out immediately on creation. This can be used to create a distributed parallel random number generator (see dust_rng_distributed_state)
algorithm
The random number algorithm to use. The default is
xoshiro256plus
which is a good general choice
sync()
Synchronise the R copy of the random number state. Typically this is only needed before serialisation if you have ever used the object.
state()
Return a raw vector of state. This can be used to create other generators with the same state.
dust::dust_rng_pointer$new()
#> <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_: 96 d0 1e b4 ab a3 7d 96 23 95 f1 6c a2 bd dd bf 29 27 98 ...