1
1
2
2
// RcppArmadillo.cpp: Rcpp/Armadillo glue
3
3
//
4
- // Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates
4
+ // Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates
5
5
//
6
6
// This file is part of RcppArmadillo.
7
7
//
@@ -49,36 +49,21 @@ Rcpp::IntegerVector armadillo_version(bool single) {
49
49
50
50
// Per request of Gábor Csárdi in https://github.com/RcppCore/RcppArmadillo/issues/11
51
51
//
52
- // ' Set the Armadillo Random Number Generator to a random value
53
- // '
54
- // ' @details
55
- // ' Depending on whether RcppArmadillo was compiled for the C++98 standard
56
- // ' (currently the default) or for C++11 (optional), two different RNGs may be used.
57
- // ' This function resets either. For C++98, the R programming language's RNG is used.
58
- // ' For C++11, the RNG included in the \code{<random>} library is used only when
59
- // ' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
60
- // ' Otherwise, the R programming language's RNG will be used.
61
- // ' @return The function is invoked for its side effect and has no return value.
62
- // ' @note This has been found to not work as espected in \pkg{RStudio}
63
- // ' as its code also uses the system RNG library. You may have to either
64
- // ' not run within \pkg{RStudio} or change your code to use a different RNG such
65
- // ' as the one from R.
66
- // ' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
52
+ // ' @rdname armadillo_set_seed
67
53
// [[Rcpp::export]]
68
54
void armadillo_set_seed_random () {
69
55
arma::arma_rng::set_seed_random (); // set the seed to a random value
70
56
}
71
57
72
- // ' Set the Armadillo Random Number Generator to the given value
58
+ // ' @title Set the Armadillo Random Number Generator to given or random value
73
59
// '
74
60
// ' @param val The seed used to initialize Armadillo's random number generator.
75
61
// ' @details
76
- // ' Depending on whether RcppArmadillo was compiled for the C++98 standard
77
- // ' (currently the default) or for C++11 (optional), two different RNGs may be used.
78
- // ' This function resets either. For C++98, the R programming language's RNG is used.
79
- // ' For C++11, the RNG included in the \code{<random>} library is used only when
80
- // ' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
81
- // ' Otherwise, the R programming language's RNG will be used.
62
+ // ' Armadillo can switch between two random number generator implementations dependeding
63
+ // ' on the compilation standard used. Under normal circumstances RcppArmadillo will connect
64
+ // ' Armadillo to the R random number generator which also implies that \code{set.seed()}
65
+ // ' should be used from R. To use this function, one also needs to undefine \code{ARMA_RNG_ALT}
66
+ // ' so that the Armadillo generators are used.
82
67
// ' @return The function is invoked for its side effect and has no return value.
83
68
// ' @note This has been found to not work as espected in \pkg{RStudio}
84
69
// ' as its code also uses the system RNG library. You may have to either
@@ -87,7 +72,6 @@ void armadillo_set_seed_random() {
87
72
// ' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
88
73
// [[Rcpp::export]]
89
74
void armadillo_set_seed (unsigned int val) {
90
- // Rcpp::Rcout << "Setting value " << val << std::endl;
91
75
arma::arma_rng::set_seed (val); // set the seed to given value
92
76
}
93
77
0 commit comments