Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dot-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 signature 'ANY'
.getRNG(object, ...)

## S4 method for signature 'missing'
.getRNG(object)

## S4 method for signature 'list'
.getRNG(object)

## S4 method for signature '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.


rngtools

Utility Functions for Working with Random Number Generators

v1.5
GPL-3
Authors
Renaud Gaujoux [aut, cre], Max Kuhn [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.