Skip to content

Commit

Permalink
FIX: preserve state of random number generator
Browse files Browse the repository at this point in the history
  • Loading branch information
TimTaylor committed Mar 12, 2024
1 parent 925a4d1 commit 568da96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 568da96

Please sign in to comment.