Learn R Programming

rngtools (version 1.5.2)

.getRNG: Getting RNG Seeds

Description

.getRNG is an S4 generic that extract RNG settings from a variety of object types. Its methods define the workhorse functions that are called by getRNG.

Usage

.getRNG(object, ...)

# S4 method for ANY .getRNG(object, ...)

# S4 method for missing .getRNG(object)

# S4 method for list .getRNG(object)

# S4 method for numeric .getRNG(object, ...)

Arguments

object

an R object from which RNG settings can be extracted, e.g. an integer vector containing a suitable value for .Random.seed or embedded RNG data, e.g., in S3/S4 slot rng or rng$noise.

...

extra arguments to allow extension and passed to a suitable S4 method .getRNG or .setRNG.

Methods (by class)

"ANY": Default method that tries to extract RNG information from object, by looking sequentially to a slot named 'rng', a slot named 'rng.seed' or an attribute names 'rng'.

It returns NULL if no RNG data was found.

"missing": Returns the current RNG settings.

"list": Method for S3 objects, that aims at reproducing the behaviour of the function getRNG of the package getRNG.

It sequentially looks for RNG data in elements 'rng', noise$rng if element 'noise' exists and is a list, or in attribute 'rng'.

"numeric": Method for numeric vectors, which returns the object itself, coerced into an integer vector if necessary, as it is assumed to already represent a value for .Random.seed.