Skip to content

Commit

Permalink
Merge pull request #92 from TimTaylor/preserve-seed
Browse files Browse the repository at this point in the history
Preserve state of random number generator
  • Loading branch information
kevinushey committed Mar 12, 2024
2 parents 925a4d1 + 568da96 commit 7a8fb36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Expand Up @@ -44,3 +44,5 @@ Collate:
'wildcards.R'
'zzz.R'
Config/Needs/website: r-lib/pkgdown, tidyverse/tidytemplate
Imports:
withr
2 changes: 2 additions & 0 deletions NEWS.md
@@ -1,5 +1,7 @@
## Rex (development version)

* Rex no longer changes the state of the random number generator when attached.

## Rex Version 1.2.1 ##

* Kevin Ushey is now the maintainer
Expand Down
2 changes: 2 additions & 0 deletions R/zzz.R
@@ -1,6 +1,8 @@
.onAttach <- function(lib, pkg) { # nolint
withr::with_preserve_seed({
if (!interactive() || stats::runif(1) > 0.1) return()

packageStartupMessage("Welcome to rex, the friendly regular expression helper!\n",
"Use 'rex_mode()' to toggle code completion for rex shortcuts and functions.")
})
}

0 comments on commit 7a8fb36

Please sign in to comment.