with_rng_state {rush}R Documentation

Set RNG Sate before Running a Function

Description

This function sets the rng state before running a function. Use with caution. The global environment is changed.

Usage

with_rng_state(fun, args, seed)

Arguments

fun

(function)
Function to run.

args

(list)
Arguments to pass to fun.

seed

(integer)
RNG state to set before running fun.

Value

any

Examples

with_rng_state(runif, list(n = 1), .Random.seed)

[Package rush version 0.1.2 Index]