Skip to content

Commit

Permalink
do not accidentally set seed on package load.
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Mar 13, 2024
1 parent 2ae5741 commit ef69ace
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: poppr
Type: Package
Title: Genetic Analysis of Populations with Mixed Reproduction
Version: 2.9.5
Version: 2.9.6
Authors@R: c(person(c("Zhian", "N."), "Kamvar", role = c("cre", "aut"),
email = "zkamvar@gmail.com", comment = c(ORCID = "0000-0003-1458-7108")),
person(c("Javier", "F."), "Tabima", role = "aut",
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
poppr 2.9.6

MISC
----

* Poppr itself will no longer accidentally modify the random seed when it is
attached (found by @timtaylor,
https://github.com/grunwaldlab/poppr/issues/259)

poppr 2.9.5
===========

Expand Down
10 changes: 6 additions & 4 deletions R/zzz.r
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@
paralltype <- ifelse(poppr::poppr_has_parallel(), "available", "unavailable")
startupmsg <- paste0(startupmsg, "\nOMP parallel support: ", paralltype, appendix)
packageStartupMessage(startupmsg)
if (!interactive() || stats::runif(1) > 0.1) return()
if (!interactive()) return()

msec <- floor(as.POSIXlt(Sys.time())$sec*1000)
if (msec %% 10 > 0) return()

tips <- c(
"\nNeed help? Try the poppr mailing list: http://groups.google.com/d/forum/poppr.\n",
"\nUse suppressPackageStartupMessages(library(\"poppr\")) to eliminate package startup messages.\n"
)

tip <- sample(tips, 1)
packageStartupMessage(tip)
msec <- floor(as.POSIXlt(Sys.time())$sec*1000)
packageStartupMessage(tips[1 + (msec %% length(n))])
}

.onLoad <- function(...){
Expand Down

0 comments on commit ef69ace

Please sign in to comment.