The RNGs and distributions functions can also be used from C++ at various levels of abstraction. Technically there are three ways to make use of dqrng at the C++ level:
// [[Rcpp::depends(dqrng)]]
together with
Rcpp::sourceCpp()
Rcpp::cppFunction(depends = "dqrng", ...)
LinkingTo: dqrng
The following functions are also available if you include
dqrng.h
.
void dqrng::dqset_seed(Rcpp::IntegerVector seed,
::Nullable<Rcpp::IntegerVector> stream = R_NilValue)
Rcppvoid dqrng::dqRNGkind(std::string kind, const std::string& normal_kind = "ignored")
seed
stream
kind
normal-kind
RNGkind
::NumericVector dqrng::dqrunif(size_t n, double min = 0.0, double max = 1.0)
Rcppdouble dqrng::runif(double min = 0.0, double max = 1.0)
n
min
max
::NumericVector dqrng::dqrnorm(size_t n, double mean = 0.0, double sd = 1.0)
Rcppdouble dqrng::rnorm(double mean = 0.0, double sd = 1.0)
n
mean
sd
::NumericVector dqrng::dqrexp(size_t n, double rate = 1.0)
Rcppdouble dqrng::rexp(double rate = 1.0)
n
rate
::IntegerVector dqrng::dqsample_int(int n, int size, bool replace = false,
Rcpp::Nullable<Rcpp::NumericVector> probs = R_NilValue,
Rcppint offset = 0)
::NumericVector dqrng::dqsample_num(double n, double size, bool replace = false,
Rcpp::Nullable<Rcpp::NumericVector> probs = R_NilValue,
Rcppint offset = 0)
n
size
replace
prob
offset
[offset, offset + m)
The two functions are used for “normal” and “long-vector” support in R.