Parallel Pseudo Random Number Generator (PPRNG) 'sitmo' Header Files

Provided within is a high quality and fast PPRNG that is able to be used in an 'OpenMP' parallel environment compiled under either C++98 or C++11. The objective of this package release is to consolidate the distribution of the 'sitmo' library on CRAN by enabling others to link to the 'sitmo' header file instead of including a copy of 'sitmo' within their individual package. Lastly, the package contains example implementations using 'sitmo' and three accompanying vignette that provide additional information.


The repository houses the sitmo R package for Parallel Psuedo Random Number Generation (PPRNG). The package provides a way to obtain the sitmo header files via LinkTo.

Installing & Using sitmo

sitmo is currently only available on GitHub, but should also be available on CRAN shortly. To install the package, you must first have a compiler on your system that is compatible with R.

For help on obtaining a compiler consult:

With a compiler in hand, one can then install the package from GitHub by:

install.packages("devtools")
 
devtools::install_github("coatless/sitmo")

To use sitmo in your R package, modify the DESCRIPTION file by adding:

LinkingTo: Rcpp, sitmo
Imports:
    Rcpp (>= 0.12.3)

To use C++11's statistical distributions, you may want to add the following to your src/Makevars and src/Makevars.win file:

CXX_STD = CXX11

Within the C++ file, then add:

Example use

Below is a hello world example meant to show a basic implementation of sitmo.

#include <Rcpp.h>
#include <random>  // C++11 RNG library 
#include <sitmo.h> // SITMO PPRNG 
 
// [[Rcpp::export]] 
Rcpp::NumericVector sitmo_draws(unsigned int n) {
  
  Rcpp::NumericVector o(n);
  
  // Create a prng engine 
  sitmo::prng_engine eng;
  
  // Draw from base engine 
  for (unsigned int i=0; i< n ; ++i){
    o(i) = eng();  
  }
 
  return o;
}

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("sitmo")

1.2.1 by James Balamuta, 21 days ago


https://github.com/coatless/sitmo, http://thecoatlessprofessor.com/projects/sitmo/, https://www.sitmo.com/?p=1206


Report a bug at https://github.com/coatless/sitmo/issues


Browse source code at https://github.com/cran/sitmo


Authors: James Balamuta [aut, cre, cph], Thijs van den Berg [aut, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp

Suggests knitr, rmarkdown, ggplot2

Linking to Rcpp


Linked to by bssm.


See at CRAN