| Type: | Package |
| Title: | An Efficient and Precise Quantile Mapping for Normal Pseudo-Random Number Generation |
| Version: | 0.0.9 |
| Date: | 2026-11-06 |
| 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 PRnorm(), a high-performance, multithreaded variant powered by 'RcppParallel' and Intel 'TBB'. Package compilation flags are optimized to support multi-core parallel processing. |
| Depends: | R (≥ 3.5.0) |
| Imports: | Rcpp (≥ 1.0.0), RcppParallel |
| LinkingTo: | Rcpp, RcppParallel |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
| VignetteBuilder: | knitr |
| License: | GPL-3 |
| Language: | en-US |
| Encoding: | UTF-8 |
| Config/roxygen2/version: | 8.1.0 |
| NeedsCompilation: | yes |
| Packaged: | 2026-11-06 20:34:26 UTC; piotr |
| Author: | Piotr Sulewski [aut, cre] |
| Maintainer: | Piotr Sulewski <piotr.sulewski@upsl.edu.pl> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-06 20:50:25 UTC |
Multi-threaded Pseudo-Normal Random Number Generator
Description
Generates pseudo-random numbers from a normal distribution using multiple threads.
Usage
PRnorm(n, mean = 0, sd = 1, seed = 12345L)
Arguments
n |
number of samples to generate |
mean |
distribution mean (default is 0.0) |
sd |
distribution standard deviation (default is 1.0) |
seed |
random number generator seed (default is 12345) |
Value
A numeric vector of length n containing pseudo-random numbers from the specified normal distribution.
Examples
# Generate 100,000 parallel random samples
samples <- PRnorm(100000, mean = 0, sd = 1)
summary(samples)
# Generate with a custom seed for reproducibility
samples_repro <- PRnorm(50000, mean = 10, sd = 2, seed = 999)
mean(samples_repro)
sd(samples_repro)
Single-threaded Pseudo-Normal Random Number Generator
Description
Original single-threaded implementation of the NormGen quantile mapping algorithm.
Usage
Rnorm(n, mean = 0, sd = 1)
Arguments
n |
number of samples to generate |
mean |
distribution mean (default is 0.0) |
sd |
distribution standard deviation (default is 1.0) |
Value
A numeric vector of length n containing pseudo-random numbers from the specified normal distribution.
Examples
# Generate 100,000 single-threaded random samples
samples_single <- Rnorm(100000, mean = 0, sd = 1)
summary(samples_single)