New Upstream Snapshot - r-cran-rngtools
Ready changes
Summary
Merged new upstream version: 1.5.2+git20210924.1.45a51ba (was: 1.5.2).
Resulting package
Built on 2023-01-20T01:36 (took 25m1s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots r-cran-rngtools
Lintian Result
Diff
diff --git a/DESCRIPTION b/DESCRIPTION
index 1abd9f9..3e7b1e8 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,8 +2,8 @@ Package: rngtools
Authors@R:
c(person("Renaud", "Gaujoux", email = "renozao@protonmail.com", role = c("aut", "cre")),
person("Max", "Kuhn", role = "ctb"))
-Version: 1.5.2
-License: GPL-3
+Version: 1.5.3
+License: GPL (>= 3)
Title: Utility Functions for Working with Random Number Generators
Description: Provides a set of functions for working with
Random Number Generators (RNGs). In particular, a generic
@@ -17,11 +17,10 @@ Encoding: UTF-8
Depends: R (>= 3.2.0), methods
Imports: digest, utils, stats, parallel
Suggests: covr, RUnit, testthat
+Roxygen: list(markdown = TRUE)
RoxygenNote: 7.0.2
NeedsCompilation: no
-Packaged: 2021-09-20 15:23:51 UTC; renaud
+Packaged: 2023-01-20 01:22:20 UTC; root
Author: Renaud Gaujoux [aut, cre],
Max Kuhn [ctb]
Maintainer: Renaud Gaujoux <renozao@protonmail.com>
-Repository: CRAN
-Date/Publication: 2021-09-20 15:50:02 UTC
diff --git a/MD5 b/MD5
deleted file mode 100644
index f9a1740..0000000
--- a/MD5
+++ /dev/null
@@ -1,22 +0,0 @@
-f85c37ebc0e09ff3ca560f117add847b *DESCRIPTION
-9fcd1a7ad06dc43b072a98d47665e0d7 *NAMESPACE
-104e54ca6877e5a6c374a6013448929a *R/RNG.R
-6f389acf73a6a632b7e2a0918004febd *R/RNGseq.R
-2e45d90d8242367b5aa8747af104e927 *R/format.R
-14798518784acfe5cc5a9b2eb16065df *R/rngtools-package.r
-83ed54171c5855ad4da6308841111cc9 *R/utils.R
-ebd079934624c564e23420f2a6826fce *README.md
-47188140a636c927cebdfabc08a3e051 *man/RNGseed.Rd
-ef1e7580ac857085d6ae212e630f7bd5 *man/RNGseq.Rd
-ec5bd23fe2b51bcbe830937772bdb642 *man/RNGstr.Rd
-f492f22f4fa8c89a638e0c2aaa7dd6c7 *man/dot-getRNG.Rd
-ef56c220057eb4f908272cd01099de2b *man/dot-setRNG.Rd
-e9d2f123dc2a0dfc756c470223999e0f *man/getRNG1.Rd
-55b42f21e7d122ea22666b2983db06d6 *man/rng.Rd
-1209f318e2b7c6dba158b402b4f5a4e0 *man/rngcmp.Rd
-ecfe5bc1a7593c9c504e613d0b4eaf67 *man/rngtools.Rd
-e0c5291d3c54be17c5f35cf094d64629 *man/uchecks.Rd
-497184d2d2283f9fe133b686aaa9211f *tests/testthat.R
-5eee11a4d8b934c745d8a9239948e727 *tests/testthat/test-RNG.r
-48b2f7a75b1d164229cc43c0072347d1 *tests/testthat/test-RNGseq.r
-1597eb803714bf6bd42346aa7ee07ebe *tests/testthat/test-format.R
diff --git a/NEWS.md b/NEWS.md
new file mode 100644
index 0000000..1b5cb36
--- /dev/null
+++ b/NEWS.md
@@ -0,0 +1,12 @@
+# Version 1.5.3
+
+ * Add NEWS file (Issue #9)
+ * Fix behaviour when .Random.seed is not set on the first call to `rngtools::setRNG()` (Issue #7)
+ * Add a LICENSE file (Issue #10)
+
+# Version 1.5.2
+
+ * Fix error reported by CRAN on R-devel (2021-09-20) (Issue #8)
+ This fix changes the behaviour of `setRNG()` when setting the random seed to an invalid value
+ in call `setRNG(..., check = FALSE)`: this now leaves the RNG unchanged, instead of putting it in a bad state.
+ This is for the better and it is highly likely that nobody would have faced this situation anyway (default is `check = TRUE`).
diff --git a/R/RNG.R b/R/RNG.R
index bc8e05b..92b7df0 100644
--- a/R/RNG.R
+++ b/R/RNG.R
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2012 Renaud Gaujoux
+# Copyright (C) 2009-2021 Renaud Gaujoux
#
# This file is part of the rngtools package for R.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
+# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
diff --git a/R/RNGseq.R b/R/RNGseq.R
index 34f0740..7fe61bc 100644
--- a/R/RNGseq.R
+++ b/R/RNGseq.R
@@ -2,6 +2,24 @@
# using L'Ecuyer's RNG
#
# Author: Renaud Gaujoux
+#
+# Copyright (C) 2009-2021 Renaud Gaujoux
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
###############################################################################
# or-NULL operator (borrowed from Hadley Wickham)
diff --git a/R/format.R b/R/format.R
index e9290aa..b43e60d 100644
--- a/R/format.R
+++ b/R/format.R
@@ -1,6 +1,23 @@
# RNG formatting functions
#
-# Author: Renaud Gaujouc
+# Author: Renaud Gaujoux
+#
+# Copyright (C) 2009-2021 Renaud Gaujoux
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
###############################################################################
#' Formatting RNG Information
diff --git a/R/rngtools-package.r b/R/rngtools-package.r
index 158681b..38b8535 100644
--- a/R/rngtools-package.r
+++ b/R/rngtools-package.r
@@ -1,3 +1,20 @@
+# Copyright (C) 2009-2021 Renaud Gaujoux
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
#' Utility functions for working with Random Number Generators
#'
#' This package contains a set of functions for working with
@@ -52,3 +69,10 @@
#' showRNG()
#'
NULL
+
+.onLoad <- function(libname, pkgname){
+ # initialize RNG seed if not defined yet
+ rs <- get0(".Random.seed", .GlobalEnv)
+ if( is.null(rs) ) do.call(base::RNGkind, as.list(base::RNGkind()))
+
+}
diff --git a/R/utils.R b/R/utils.R
index 4f3a6c2..72925ee 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -1,3 +1,19 @@
+# Copyright (C) 2009-2021 Renaud Gaujoux
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# from pkgmaker 0.30
isNumber <- function(x){
diff --git a/debian/changelog b/debian/changelog
index 8132c53..0ac4038 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-r-cran-rngtools (1.5.2-2) UNRELEASED; urgency=medium
+r-cran-rngtools (1.5.2+git20210924.1.45a51ba-1) UNRELEASED; urgency=medium
+ [ Andreas Tille ]
* Disable reprotest
- -- Andreas Tille <tille@debian.org> Thu, 23 Sep 2021 11:37:18 +0200
+ [ Debian Janitor ]
+ * New upstream snapshot.
+
+ -- Andreas Tille <tille@debian.org> Fri, 20 Jan 2023 01:22:49 -0000
r-cran-rngtools (1.5.2-1) unstable; urgency=medium
diff --git a/tests/testthat.R b/tests/testthat.R
index 4cd4da4..c0a6cc1 100755
--- a/tests/testthat.R
+++ b/tests/testthat.R
@@ -1,3 +1,17 @@
+# Copyright: Renaud Gaujoux (2009-2021)
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+###################################################################
+
library(testthat)
library(rngtools)
diff --git a/tests/testthat/test-RNG.r b/tests/testthat/test-RNG.r
index 27e7da7..acfd9e5 100644
--- a/tests/testthat/test-RNG.r
+++ b/tests/testthat/test-RNG.r
@@ -1,6 +1,18 @@
# Unit test for getRNG
#
# Author: Renaud Gaujoux
+# Copyright: Renaud Gaujoux (2009-2021)
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
###############################################################################
context("Get/Set RNG")
@@ -132,3 +144,19 @@ test_that('setRNG', {
})
+
+test_that('.Random.seed init', {
+ cmd <- 'Rscript -e "RNGkind(); rngtools::RNGseq(2, seed=200); RNGkind();"'
+ out <- capture.output(system(cmd, intern = TRUE))
+ expect_true(!any(grepl("Ecuyer", out)))
+
+ tmpf <- tempfile(tmpdir = getwd())
+ on.exit( unlink(tmpf) )
+ cmd <- sprintf('Rscript -e "runif(1); s <- .Random.seed; RNGkind(); rngtools::RNGseq(2, seed=200); RNGkind(); saveRDS(identical(s, .Random.seed), \\"%s\\")"',
+ tmpf)
+ out <- capture.output(system(cmd, intern = TRUE))
+ print(out)
+ expect_true(readRDS(tmpf))
+
+})
+
diff --git a/tests/testthat/test-RNGseq.r b/tests/testthat/test-RNGseq.r
index 2b19c3f..9e4eac5 100644
--- a/tests/testthat/test-RNGseq.r
+++ b/tests/testthat/test-RNGseq.r
@@ -1,6 +1,18 @@
# Unit tets for RNGseq
#
# Author: Renaud Gaujoux
+# Copyright: Renaud Gaujoux (2009-2021)
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
###############################################################################
context("RNGseq: RNG streams")
diff --git a/tests/testthat/test-format.R b/tests/testthat/test-format.R
index 00a7bae..472e028 100644
--- a/tests/testthat/test-format.R
+++ b/tests/testthat/test-format.R
@@ -2,7 +2,20 @@
#
# Author: Renaud Gaujoux (edited by Max Kuhn)
# Created: 01 May 2018
-# Copyright: Cytoreason (2017)
+# Copyright: Renaud Gaujoux (2017-2021)
+# Copyright: Max Kuhn (2019)
+#
+# This file is part of the rngtools package for R.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
###############################################################################
context("Formatting functions")
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/R/site-library/rngtools/NEWS.md
Control files: lines which differ (wdiff format)
Depends: r-base-core (>= 4.2.0-1), 4.2.2.20221110-1), r-api-4.0, r-cran-digest