Description Usage Arguments Details Value Note Author(s) References See Also Examples
The function rpgm.rnorm uses the Ziggurat algorithm with a 128-regions table, in order to simulate normal random variables faster than rnorm
.
1 | rpgm.rnorm(n, mean = 0, sd = 1, nthreads = 1L)
|
n |
integer, number of simulations. |
mean |
double, the mean (or the vector of means). |
sd |
double, the standard deviation (or the vector of standard deviations). |
nthreads |
integer, the number of threads to use for parallelism. |
If mean
or sd
are not specified they assume the default values of 0 and 1, respectively. By default the number of threads is 1 so there is no multi-core.
A vector of i.i.d. normal random variables.
For a big number of simulations, with nthreads = 1, it is approximately four times faster than the usual rnorm
. For one simulution, it is around one half faster.
Nicolas Baradel - PGM Solutions
https://en.wikipedia.org/wiki/Ziggurat_algorithm
http://pgm-solutions.com/packages
1 2 | rpgm.rnorm(5)
rpgm.rnorm(5, nthreads = maxthreads())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.