[Rcpp-devel] RcppArmadillo generates warning with arma_rng::set_seed_random()

Dirk Eddelbuettel edd at debian.org
Fri Feb 20 20:24:26 CET 2015


On 20 February 2015 at 13:14, terrance savitsky wrote:
| When using - arma_rng::set_seed_random(),
| to initialize the RNG in RcppArmadillo, the following warning is generated,
| 
| When called from R, the RNG seed has to be set at the R level via set.seed()
| 
| 
| This warning seems appropriate when using set_seed(), but not set_seed_random()
| since setting a random seed does not represent a mistaken attempt to fix an
| Armadillo random seed at the R level.

See the source file eg via

  https://github.com/RcppCore/RcppArmadillo/blob/master/inst/include/RcppArmadillo/Alt_R_RNG.h

IIRC this all started because R CMD check started to notice use of rand() by
Armadillo and warns against that (as there have been bad rand() versions in C
and old C++ libraries).

If it bugs you greatly you can either use R's RNGs directly, use Boost's, use
the ones from the C++(11) library, or grow your own.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list