Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Preserve state of random number generator in .onattach() #91

@TimTaylor

Description

@TimTaylor

Currently .onAttach() will change the state of a users random number generator.

rex/R/zzz.R

Lines 1 to 3 in 925a4d1

.onAttach <- function(lib, pkg) { # nolint
if (!interactive() || stats::runif(1) > 0.1) return()

Would you consider a change to preserve it?

For reference I believe {ggplot2} was updated to use withr::with_preserve_seed() for this reason.

Motivate by this thread https://fosstodon.org/@[email protected]/112079393660379008

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions