| Title: | An Efficient and Precise Quantile Mapping for Normal Pseudo-Random Number Generation |
|---|---|
| Description: | High-performance pseudo-normal random generator using an optimized quantile mapping algorithm. It provides fast generation of normal pseudo-random numbers based on precise mathematical approximations. The package features Rnorm() for efficient single-threaded generation and parallel_Rnorm(), a high-performance, multithreaded variant powered by 'RcppParallel' and Intel 'TBB'. Package compilation flags are optimized to support multi-core parallel processing. |
| Authors: | Piotr Sulewski [aut, cre] |
| Maintainer: | Piotr Sulewski <[email protected]> |
| License: | GPL-3 |
| Version: | 0.0.6 |
| Built: | 2026-10-22 19:28:52 UTC |
| Source: | https://github.com/cran/NormGen |
Generates multi-core parallel processing normal pseudo-random numbers powered by 'RcppParallel' and Intel 'TBB'.
parallel_Rnorm(n, mean = 0, sd = 1, seed = 12345L)parallel_Rnorm(n, mean = 0, sd = 1, seed = 12345L)
n |
An integer specifying the number of observations to generate. |
mean |
A numeric value specifying the mean of the distribution. Default is 0. |
sd |
A numeric value specifying the standard deviation of the distribution. Default is 1. |
seed |
An integer to initialize the pseudo-random number generator state. Default is 12345L. |
This function divides the generation task across available CPU threads to maximize execution performance. By passing a specific integer to the seed parameter, you ensure the full reproducibility of the obtained results across different executions.
A numeric vector containing n pseudo-random numbers drawn from the specified normal distribution.
Piotr Sulewski [email protected]
# Generate parallel numbers with an explicit seed parallel_samples <- parallel_Rnorm(1000, mean = 0, sd = 1, seed = 2026) # Verify reproducibility directly via the parameter verify_samples <- parallel_Rnorm(1000, mean = 0, sd = 1, seed = 2026) identical(parallel_samples, verify_samples)# Generate parallel numbers with an explicit seed parallel_samples <- parallel_Rnorm(1000, mean = 0, sd = 1, seed = 2026) # Verify reproducibility directly via the parameter verify_samples <- parallel_Rnorm(1000, mean = 0, sd = 1, seed = 2026) identical(parallel_samples, verify_samples)
Generates high-performance normal pseudo-random numbers based on an optimized quantile mapping algorithm.
Rnorm(n, m = 0, s = 1)Rnorm(n, m = 0, s = 1)
n |
An integer specifying the number of observations to generate. |
m |
A numeric value specifying the mean of the distribution. Default is 0. |
s |
A numeric value specifying the standard deviation of the distribution. Default is 1. |
This function applies precise mathematical approximations to provide a fast alternative to the classic rnorm function.
A numeric vector containing n pseudo-random numbers drawn from the specified normal distribution.
Piotr Sulewski [email protected]
Sulewski P., Drapella A. (2026). An Efficient and Precise Quantile Mapping for Normal Pseudo-Random Number Generation. Journal of Statistical Software, Under review.
# Generate 100 random numbers from N(0,1) samples <- Rnorm(100) mean(samples) sd(samples) # Generate with custom mean and standard deviation custom_samples <- Rnorm(10, m = 2, s = 2)# Generate 100 random numbers from N(0,1) samples <- Rnorm(100) mean(samples) sd(samples) # Generate with custom mean and standard deviation custom_samples <- Rnorm(10, m = 2, s = 2)