{"id":50415204,"url":"https://github.com/biostochastics/qiprng","last_synced_at":"2026-05-31T05:30:26.982Z","repository":{"id":281615670,"uuid":"940993774","full_name":"biostochastics/qiprng","owner":"biostochastics","description":"High-precision, configurable pseudo-random number generator based on quadratic irrational numbers with optional ChaCha20 mixing in R","archived":false,"fork":false,"pushed_at":"2026-01-19T09:43:41.000Z","size":62126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-19T16:12:47.582Z","etag":null,"topics":["cpp","prng-algorithms","r-language"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biostochastics.png","metadata":{"files":{"readme":"README.Md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-01T08:15:16.000Z","updated_at":"2026-01-19T09:43:45.000Z","dependencies_parsed_at":"2025-04-06T02:30:59.585Z","dependency_job_id":"fc046226-a122-4f50-9159-221d784ab477","html_url":"https://github.com/biostochastics/qiprng","commit_stats":null,"previous_names":["biostochastics/qiprng"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/biostochastics/qiprng","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biostochastics%2Fqiprng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biostochastics%2Fqiprng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biostochastics%2Fqiprng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biostochastics%2Fqiprng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biostochastics","download_url":"https://codeload.github.com/biostochastics/qiprng/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biostochastics%2Fqiprng/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33720897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","prng-algorithms","r-language"],"created_at":"2026-05-31T05:30:26.186Z","updated_at":"2026-05-31T05:30:26.973Z","avatar_url":"https://github.com/biostochastics.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qiprng: Quadratic Irrational Pseudo-Random Number Generator for R\n\n\u003cimg src=\"images/qiprng_logo.png\" alt=\"QIPRNG Logo\" width=\"300\"/\u003e\n\n[![Version](https://img.shields.io/badge/Version-0.7.3-blue)](https://github.com/biostochastics/qiprng)\n[![ThreadSafe](https://img.shields.io/badge/Thread%20Safe-Yes-brightgreen)](https://github.com/biostochastics/qiprng)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![R-CMD-check](https://img.shields.io/badge/R--CMD--check-passing-brightgreen)](https://github.com/biostochastics/qiprng)\n[![Language](https://img.shields.io/badge/Language-R%2FC%2B%2B-blue.svg)](https://www.r-project.org/)\n[![Tests](https://img.shields.io/badge/Statistical%20Tests-70%2B-brightgreen)](https://github.com/biostochastics/qiprng)\n[![SIMD](https://img.shields.io/badge/SIMD-AVX2%2FNEON-orange)](https://github.com/biostochastics/qiprng)\n[![Parallel](https://img.shields.io/badge/Parallel-OpenMP-green)](https://github.com/biostochastics/qiprng)\n\n## Overview\n\nThe `qiprng` package implements a pseudo-random number generator based on quadratic\nirrational numbers with hardware acceleration and parallel generation capabilities.\nIt offers high-precision arithmetic, optional ChaCha20 output mixing, and extensive\nstatistical distribution support.\n\n```r\nlibrary(qiprng)\ncreatePRNG()\nx \u003c- generatePRNG(10000)\nhist(x, breaks = 50, main = \"qiprng uniform distribution\", col = \"skyblue\")\n```\n\n## Version History\n\nFor recent changes, see [NEWS.md](NEWS.md). For complete version history with\ndetailed technical notes, see [CHANGELOG.md](CHANGELOG.md).\n\n## Key Features\n\nThe package offers high-precision computation using the MPFR library with configurable\nprecision from 24 to 10,000 bits, supporting over 14 statistical distributions including\nstandard continuous and discrete distributions as well as extended distributions like\nLevy stable, Pareto, and multivariate normal. Hardware acceleration is provided through\nSIMD vectorization with AVX2/NEON support and enhanced OpenMP parallelization with\nthread-local caching, SIMD integration, and optimized buffer management for improved\nperformance on modern multi-core systems.\n\nMultiple strategies support parallel stream generation: parameter splitting (independent\ndiscriminants per stream), stream leapfrogging, and crypto counter-mode mixing. The\npackage provides MPFR-based high-precision iteration for sequential jump-ahead with\nautomatic overflow prevention. An optional output mixing\nlayer uses ChaCha20 stream cipher with XOR mixing for preserving uniformity or modular\naddition for enhanced entropy. Thread safety is guaranteed through proper synchronization\nprimitives and thread-local resources, while deterministic mode with seed support enables\nreproducible sequences for research and testing. The generator has been validated using\nthe NIST SP 800-22 statistical test framework.\n\n## Quick Start\n\n```r\n# Install from GitHub\nremotes::install_github(\"biostochastics/qiprng\")\n\n# Generate random numbers\nlibrary(qiprng)\ncreatePRNG()\nrandom_values \u003c- generatePRNG(1000)\n```\n\nFor detailed installation instructions by platform, see the [Installation](#installation)\nsection below.\n\n## Acknowledgments\n\n\u003e This implementation is based on **Vincent Granville's** work on random number generators\n\u003e using quadratic irrationals. The mathematical foundation and the core algorithm design\n\u003e follow Granville's approach.\n\u003e\n\u003e **Reference:** Granville, V. (2022). [Random Number Generator Based on Quadratic\n\u003e Irrationals](https://mltechniques.com/2022/12/13/military-grade-fast-random-number-generator-based-on-quadratic-irrationals/).\n\u003e Note: The original work has not been peer-reviewed in cryptographic literature.\n\n## Performance \u0026 Quality\n\nThe generator achieves excellent performance in single-threaded mode with\nnear-linear scaling in multi-threaded configurations. Memory usage remains constant at\nO(1) with thread-local caching. All 750 possible discriminants have been validated\nthrough statistical testing. The package includes a curated set of 370 discriminants\nthat passed comprehensive testing, which is used by default. For research purposes, all\ndiscriminants can be enabled through configuration options.\n\nThe generator passes 98.4% of NIST SP 800-22 statistical tests, indicating good\ndistributional properties. Note that NIST tests detect obvious statistical defects but\ndo not establish cryptographic security—they are a necessary but not sufficient\ncondition for security-sensitive applications.\n\n## Installation\n\nThis package contains C++ code and requires a compiler and several system libraries to be\ninstalled on your system before the R package can be built.\n\n### Prerequisites\n\n#### macOS\n\nYou will need to install the Command Line Tools for Xcode and the required libraries using\n[Homebrew](https://brew.sh/).\n\n1. **Install Xcode Command Line Tools**:\n\n    ```sh\n    xcode-select --install\n    ```\n\n2. **Install Homebrew** (if you don't have it):\n\n    ```sh\n    /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n    ```\n\n3. **Install required libraries**:\n\n    ```sh\n    brew install pkg-config gmp mpfr libsodium openssl\n    ```\n\n#### Linux (Debian/Ubuntu)\n\nUse `apt-get` to install the required development libraries:\n\n```sh\nsudo apt-get update\nsudo apt-get install build-essential libmpfr-dev libgmp-dev libsodium-dev libssl-dev\n```\n\n#### Linux (Fedora/CentOS/RHEL)\n\nUse `yum` or `dnf` to install the required development libraries:\n\n```sh\nsudo dnf groupinstall \"Development Tools\"\nsudo dnf install gmp-devel mpfr-devel libsodium-devel openssl-devel\n```\n\n#### Windows\n\nFor Windows, the required libraries are downloaded automatically during installation, but\nyou need to have [Rtools](https://cran.r-project.org/bin/windows/Rtools/) installed and\nconfigured correctly.\n\n### Install the Package\n\nOnce the prerequisites are installed, you can install `qiprng` from GitHub using the\n`remotes` package in R:\n\n```r\nif (!require(\"remotes\")) {\n  install.packages(\"remotes\")\n}\nremotes::install_github(\"biostochastics/qiprng\")\n```\n\n## Supported Distributions\n\n**Continuous Distributions:**\n\n- Uniform\n- Normal\n- Exponential\n- Gamma\n- Beta\n- Log-Normal\n- Weibull\n- Chi-Squared\n- Student's t\n- Levy Stable (Alpha-stable random variates using Chambers-Mallows-Stuck algorithm)\n- Pareto (Heavy-tailed distribution for extreme events modeling)\n- Cauchy (Fat-tailed distribution with undefined mean)\n- Multivariate Normal (Correlated normal vectors, requires Eigen3)\n\n**Discrete Distributions:**\n\n- Bernoulli\n- Binomial\n- Poisson\n- Negative Binomial\n\n**Special Distributions:**\n\n- Gaussian Copula (Complex dependencies between different marginal distributions)\n\n### Distribution Examples\n\n```r\n# Standard distributions\ncreatePRNG(list(distribution = \"normal\", normal_mean = 0, normal_sd = 1))\nnormal_samples \u003c- generatePRNG(1000)\n\ncreatePRNG(list(distribution = \"exponential\", exponential_lambda = 0.5))\nexp_samples \u003c- generatePRNG(1000)\n\n# Extended distributions\nlevy_samples \u003c- generate_levy_stable(n = 1000, alpha = 1.5, beta = 0.5, mu = 0, sigma = 1)\npareto_samples \u003c- generate_pareto(n = 1000, xm = 1, alpha = 2.5)\ncauchy_samples \u003c- generate_cauchy(n = 1000, location = 0, scale = 1)\n\n# Multivariate normal\nmean_vec \u003c- c(0, 0, 0)\ncov_mat \u003c- matrix(c(1, 0.5, 0.2, 0.5, 1, 0.3, 0.2, 0.3, 1), 3, 3)\nmvn_samples \u003c- generate_multivariate_normal(n = 1000, mean_vec, cov_mat)\n\n# Gaussian copula\ncorrelation \u003c- matrix(c(1, 0.7, 0.7, 1), 2, 2)\nmarginals \u003c- list(\n  list(type = \"cauchy\", location = 0, scale = 1),\n  list(type = \"pareto\", xm = 1, alpha = 3)\n)\ncopula_samples \u003c- generate_with_copula(n = 1000, correlation, marginals)\n```\n\n## Architecture\n\n### Lock-Free Thread-Local Design\n\nThe optimized architecture eliminates mutex contention through thread-local storage:\n\n```cpp\n// Each thread maintains its own PRNG state\nstatic thread_local ThreadLocalData {\n    std::vector\u003cQuadraticIrrational\u003e qis;  // Thread-local QI instances\n    std::vector\u003cdouble\u003e cache;              // L1-optimized cache (4096 samples)\n    size_t cache_pos;                       // Current position in cache\n} tl_data;\n```\n\nKey optimizations include:\n\n- **Zero Contention**: Each thread has independent PRNG instances\n- **Cache-Line Alignment**: 64-byte alignment prevents false sharing\n- **Golden Ratio Seeding**: `thread_seed = base_seed + thread_id * 0x9E3779B97F4A7C15`\n- **Prefetching**: Hardware prefetch hints for sequential access patterns\n\n## Usage\n\n### Basic Usage\n\nThe simplest way to use qiprng is with default settings. The generator automatically\nselects optimal parameters and uses uniform distribution over [0,1]:\n\n```r\nlibrary(qiprng)\ncreatePRNG()\nx \u003c- generatePRNG(10000)\nmean(x)  # ~0.5\nvar(x)   # ~1/12\n```\n\n### Distributions\n\nConfigure the generator for different statistical distributions by specifying the\ndistribution type and its parameters:\n\n```r\n# Normal distribution\ncreatePRNG(list(\n  distribution = \"normal\",\n  normal_mean = 0,\n  normal_sd = 1\n))\nnorm_samples \u003c- generatePRNG(1000)\n\n# Exponential distribution\ncreatePRNG(list(\n  distribution = \"exponential\",\n  exponential_lambda = 0.5\n))\nexp_samples \u003c- generatePRNG(1000)\n\n# Switch distributions dynamically\nupdatePRNG(list(distribution = \"poisson\", poisson_lambda = 3.5))\npois_samples \u003c- generatePRNG(1000)\n```\n\n### Advanced Configuration\n\nFor high-performance applications, you can customize precision, mixing strategies, and\nparallelization:\n\n```r\ncfg \u003c- list(\n  a = 2L, b = 5L, c = -2L,         # Custom quadratic coefficients\n  mpfr_precision = 256L,           # Higher precision (24-10000 bits)\n  mixing_strategy = \"cascade_mix\",  # Enhanced entropy mixing\n  use_parallel_filling = TRUE,     # Enable parallel generation\n  buffer_size = 100000             # Large buffer for efficiency\n)\ncreatePRNG(cfg)\nhigh_quality_samples \u003c- generatePRNG(1000000)\n```\n\n### Thread-safe Example\n\n```r\nlibrary(qiprng)\nlibrary(parallel)\n\n# Create a thread-safe PRNG configuration\ncreatePRNG(list(\n  distribution = \"normal\",\n  normal_method = \"ziggurat\",   # Both ziggurat and box_muller are supported and fully thread-safe\n  use_threading = TRUE,         # Enable thread safety\n  use_parallel_filling = FALSE, # For maximum stability\n  buffer_size = 10000,          # Larger buffer for better performance\n  debug = TRUE                  # Enable debug output\n))\n\n# Use parallel processing with the thread-safe PRNG\ncl \u003c- makeCluster(4)\nclusterEvalQ(cl, library(qiprng))\n\n# The same PRNG can now be safely used across parallel workers\nresults \u003c- parSapply(cl, 1:4, function(i) {\n  # Each worker gets values from the shared thread-safe PRNG\n  values \u003c- generatePRNG(5000)\n  c(mean = mean(values), sd = sd(values))\n})\n\nstopCluster(cl)\nprint(results)\n```\n\n### Reproducible Random Numbers (Deterministic Mode)\n\nFor scientific computing and testing, you can enable fully reproducible sequences. Version 0.6.5\nensures perfect determinism - identical seeds always produce identical sequences:\n\n```r\n# Set a seed for reproducibility\ncfg \u003c- list(\n  seed = 12345,\n  a = 2L,\n  b = 5L,\n  c = -2L\n)\ncreatePRNG(cfg)\n\n# This will always produce the same sequence\nset1 \u003c- generatePRNG(100)\n\n# Create another PRNG with the same seed\ncleanup_prng()\ncreatePRNG(cfg)\nset2 \u003c- generatePRNG(100)\n\n# Verify they're identical\nall(set1 == set2)  # TRUE\n```\n\nNote: When seed is provided, the PRNG uses deterministic initialization while maintaining\nmathematical properties. The generator performs a warm-up period for proper mixing. For\nfull determinism with normal distributions, use `normal_method = \"box_muller\"`.\n\n### MultiQI Mixing Strategies\n\n```r\n# Multiple quadratic irrationals with mixing\ncfg \u003c- list(\n  a = c(2, 3, 5),          # Multiple QI coefficients\n  b = c(7, 11, 13),\n  c = c(-3, -5, -7),\n  mixing_strategy = \"cascade_mix\"  # Choose mixing strategy\n)\ncreatePRNG(cfg)\n\n# Available strategies:\n# round_robin: Cycles through QIs sequentially (fastest)\n# xor_mix: XOR combines outputs for bit diffusion (preserves uniformity)\n# averaging: Averages multiple QI outputs (note: produces triangular, not uniform distribution)\n# modular_add: Modular addition of outputs (preserves uniformity)\n# cascade_mix: Cascaded mixing for maximum entropy\n```\n\n### Jump-Ahead and Parallel Streams\n\n```r\n# For parallel applications, the recommended approach is parameter splitting:\n# Different (a, b, c) triplets produce statistically independent sequences\ncfg \u003c- list(\n  a = c(2, 3, 5),          # Multiple QI coefficients\n  b = c(7, 11, 13),\n  c = c(-3, -5, -7),\n  mixing_strategy = \"modular_add\"\n)\ncreatePRNG(cfg)\n\n# Sequential jump-ahead is also available for moderate distances:\ncreatePRNG()\ninitial \u003c- generatePRNG(5)\njumpAheadPRNG(10000)  # Direct iteration with MPFR precision\nafter_jump \u003c- generatePRNG(5)\n\n# Note: Unlike linear congruential generators, the nonlinear quadratic\n# map does not admit O(log n) matrix-based jump-ahead. See MATH.md\n# Appendix A.9 for the mathematical proof.\n```\n\n## Statistical Testing\n\nThe package includes a comprehensive testing framework with over 70 statistical tests\ncovering distribution uniformity, independence, correlation, and entropy. The test suite\nimplements the NIST SP 800-22 standards along with classical PRNG tests.\n\n### NIST SP 800-22 Validation Results\n\nTesting was performed using the NIST Statistical Test Suite (STS) on binary sequences\ngenerated from five different discriminant configurations.\n\n**Test Results Summary:**\n\n- **Pass Rate:** 98.4% (185/188 tests passed)\n- **Test Coverage:** All 15 NIST test categories\n- **Sequence Length:** 1 million bits per test\n\nThe generator passed all fundamental randomness tests including Frequency, Runs, DFT,\nRandom Excursions, and Linear Complexity tests. The minor failures (3 out of 148\nNon-overlapping Template tests) fall within acceptable statistical variation.\n\nTo reproduce the NIST validation:\n\n- Binary sequence generation script: [`validation/nist_top5_sequences/generate_binary_for_nist.R`](validation/nist_top5_sequences/generate_binary_for_nist.R)\n- Test discriminants used: [`validation/nist_top5_sequences/discriminants_used.csv`](validation/nist_top5_sequences/discriminants_used.csv)\n- The script generates 100 sequences of 1M bits each per discriminant for NIST STS testing\n\n```\n\n## Mathematical Foundation\n\nThe generator implements the quadratic irrational recurrence relation\nx_{n+1} = (a·x_n² + b·x_n + c) mod 1, where the coefficients are constrained to\na \u003e 0, c \u003c 0, and Δ = b² - 4ac \u003e 0. These constraints define an empirical parameter\nfamily that tends to produce richer folding behavior under mod-1 projection. With\nproperly validated parameters, this deterministic dynamical system on [0,1) produces\nsequences with excellent statistical properties. Each parameter set is validated\nthrough empirical testing.\n\n**Key mathematical guarantees** (see [MATH.md](MATH.md) Appendix A for proofs):\n\n- Modular-addition mixing with ChaCha20 yields *provably uniform* output (Haar invariance)\n- XOR mixing with a uniform operand produces uniform mantissas\n- Multi-stream modular addition reduces bias geometrically (Fourier damping)\n- CFE periodicity for quadratic irrationals follows from Lagrange's theorem\n\n**Important caveats**: The discriminant condition Δ \u003e 0 is a screening heuristic, not\na mathematical guarantee of chaos or uniformity. The generator's statistical quality\ndepends on empirical validation of specific parameter sets. For rigorous analysis,\nsee [MATH.md](MATH.md).\n\n## Performance Considerations\n\nThe qiprng generator prioritizes high-precision arithmetic and mathematical rigor over\nraw speed. Using MPFR arbitrary-precision arithmetic and optional ChaCha20 output mixing,\nit runs approximately 50x slower than simple linear congruential generators. This may be\njustified when high-precision arithmetic or exotic seeding mechanisms are required. For\napplications prioritizing throughput, consider xoshiro256++, PCG64, or similar modern\nPRNGs which offer excellent statistical properties at higher speed. For general Monte\nCarlo simulations where speed is paramount, standard generators like Mersenne Twister may\nbe more appropriate.\n\n## Security Considerations\n\n**This generator has not undergone formal cryptographic analysis.**\n\nWhile qiprng passes standard statistical tests and offers optional ChaCha20 mixing, it\nshould not be considered a cryptographically secure PRNG (CSPRNG). Specifically:\n\n- No proof exists that the generator satisfies the \"next-bit test\" (computational\n  indistinguishability from true randomness)\n- State recovery may be feasible if an attacker can determine the current position in\n  the quadratic irrational expansion\n- The ChaCha20 mixing layer, when enabled, provides the actual resistance to state\n  recovery—the QI layer contributes computational cost without proven security benefit\n\n**For cryptographic applications** (key generation, nonces, IVs, etc.), use:\n- `sodium::randombytes()` (libsodium)\n- `openssl::rand_bytes()`\n- System CSPRNGs (`/dev/urandom`, `CryptGenRandom`)\n\n**qiprng is appropriate for:**\n- Scientific computing requiring reproducible, high-precision random sequences\n- Research into number-theoretic PRNG constructions\n- Applications where the seeding mechanism or precision requirements are not met by\n  standard generators\n\n## Caching Framework\n\nThe package includes a powerful caching system to optimize performance for repeated operations:\n\n### Cache Management\n\n```r\n# Enable/disable caching\nset_cache_enabled(TRUE)\nis_cache_enabled()  # Check status\n\n# Clear cache entries\nclear_qiprng_cache()  # Clear all\nclear_qiprng_cache(\"acf\")  # Clear by pattern (regex supported)\n\n# Export and import cache\nexport_cached_results(\"cache_backup.rds\")\nimport_cached_results(\"cache_backup.rds\", overwrite = FALSE)\n\n# Cache statistics\nqiprng_cache_stats()  # Overall cache info\ntest_cache_stats()    # Test-specific cache stats\n```\n\n### Cached Functions\n\nThe framework provides cached versions of expensive computations:\n\n```r\n# Cached statistical functions\ncached_acf(x, lag.max = 50)     # Autocorrelation\ncached_pacf(x, lag.max = 50)    # Partial autocorrelation\ncached_spectrum(x)               # Spectral density\ncached_compress(x, type = \"gzip\")  # Compression\n\n# Test result caching\ncached_test_result(test_func, test_name, test_category,\n                  data, config, ...)\n```\n\n## API Reference\n\n### Core Functions\n\nThe package provides a simple yet powerful API for random number generation:\n\n- **`createPRNG(config)`** - Initializes a new generator with specified configuration\n- **`generatePRNG(n)`** - Generates n random values using current settings\n- **`updatePRNG(config)`** - Updates generator configuration dynamically\n- **`jumpAheadPRNG(n)`** - Advances state by n steps for parallel streams\n- **`reseedPRNG()`** - Reinitializes with fresh entropy\n- **`cleanupPRNG()`** - Releases resources and cleans up memory\n\n### Configuration Options\n\nThe generator accepts numerous configuration parameters to customize behavior. Key options\ninclude quadratic coefficients (a, b, c), MPFR precision (24-10000 bits), distribution\ntype and parameters, mixing strategy for multiple QIs, ChaCha20 output mixing settings,\nand parallelization options. See the package documentation for complete parameter\ndescriptions and valid ranges.\n\n### Environment Variables\n\nThe following environment variables can be used to control MPFR optimization behavior:\n\n- **`QIPRNG_FORCE_MPFR`** - Set to `1` to disable fast-path optimization and force MPFR operations\n- **`QIPRNG_FAST_PATH`** - Set to `1` to force fast-path even for precision \u003e 64 bits\n- **`QIPRNG_ENABLE_MPFR_DIAGNOSTICS`** - Set to `1` to enable precision loss tracking (compile-time flag)\n\nThese variables are useful for debugging, benchmarking, and ensuring reproducible results\nin research environments.\n\n### Testing Functions\n\nThe testing framework provides comprehensive validation capabilities through `test_prng()`\nfor quick validation, `create_prng_test_suite()` for custom test configurations, and\n`run_prng_test_suite()` for executing full test batteries with detailed reporting.\n\n## Dependencies\n\n- R (\u003e= 4.0.0)\n- Rcpp (\u003e= 1.0.0)\n- MPFR library (for high-precision arithmetic)\n- libsodium (for optional ChaCha20 output mixing)\n\n## Contributing\n\nContributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed\nguidelines including:\n\n- Development environment setup\n- Pre-commit hooks configuration\n- Code style guidelines (R and C++)\n- Testing procedures\n\nQuick start:\n\n```bash\ngit clone https://github.com/biostochastics/qiprng.git\ncd qiprng\npre-commit install  # Set up code quality hooks\nR CMD INSTALL .\n```\n\n## Citation\n\nIf you use this package in your research, please cite:\n\n```bibtex\n@Manual{qiprng,\n  title = {qiprng: Quadratic Irrational Pseudo-Random Number Generator for R},\n  author = {Sergey Kornilov},\n  year = {2025},\n  note = {R package version 0.7.3},\n  url = {https://github.com/biostochastics/qiprng}\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nSergey Kornilov - \u003csergey.kornilov@biostochastics.com\u003e\n\nProject Link: [https://github.com/biostochastics/qiprng](https://github.com/biostochastics/qiprng)\n\n---\n\n*Part of the [Biostochastics](https://github.com/biostochastics) collection of tools for\ntranslational science and biomarker discovery*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiostochastics%2Fqiprng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiostochastics%2Fqiprng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiostochastics%2Fqiprng/lists"}