seed_funs: Do a computation with a given seed.

Description Usage Arguments Details Value Note See Also

Description

Do a computation with a given seed.

safe version of retrieving the .Random.seed

Get or Set Current Seed - Safe Version

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
withseed(seed, expr, envir = parent.frame(),
  cache = getOption("harvestr.use.cache", defaults$cache()),
  cache.dir = getOption("harvestr.cache.dir", defaults$cache.dir()),
  time = getOption("harvestr.time", defaults$time()))

get.seed()

replace.seed(seed, delete = TRUE)

GetOrSetSeed()

Arguments

seed

a valid seed value

expr

expression to evaluate.

envir

the environment to evaluate the code in.

cache

should results be cached or retrieved from cache.

cache.dir

Where should cached results be saved to/retrieve from.

time

should results be timed?

delete

logical to delete if seed is null.

Details

Compute the expr with the given seed, replacing the global seed after compuatations are finished.

does not replace the global .Random.seed

Replaces the .Random.seed with seed unless seed is null, then it will delete the .Random.seed if delete=T

Always returns a valid seed. Useful for grabbing a seed used to generate a random object.

Value

the .Random.seed if defined, otherwise NULL

a valid .Random.seed value.

Note

Not parallel compatible, this modifies the global environment, while processing.

See Also

set.seed


harvestr documentation built on May 30, 2017, 2:39 a.m.