11
22// RcppArmadillo.cpp: Rcpp/Armadillo glue
33//
4- // Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates
4+ // Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates
55//
66// This file is part of RcppArmadillo.
77//
@@ -49,36 +49,21 @@ Rcpp::IntegerVector armadillo_version(bool single) {
4949
5050// Per request of Gábor Csárdi in https://github.com/RcppCore/RcppArmadillo/issues/11
5151//
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
6753// [[Rcpp::export]]
6854void armadillo_set_seed_random () {
6955 arma::arma_rng::set_seed_random (); // set the seed to a random value
7056}
7157
72- // ' Set the Armadillo Random Number Generator to the given value
58+ // ' @title Set the Armadillo Random Number Generator to given or random value
7359// '
7460// ' @param val The seed used to initialize Armadillo's random number generator.
7561// ' @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.
8267// ' @return The function is invoked for its side effect and has no return value.
8368// ' @note This has been found to not work as espected in \pkg{RStudio}
8469// ' as its code also uses the system RNG library. You may have to either
@@ -87,7 +72,6 @@ void armadillo_set_seed_random() {
8772// ' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
8873// [[Rcpp::export]]
8974void armadillo_set_seed (unsigned int val) {
90- // Rcpp::Rcout << "Setting value " << val << std::endl;
9175 arma::arma_rng::set_seed (val); // set the seed to given value
9276}
9377
0 commit comments