Skip to main content

Benchmark QIPRNG against other random number generators

This function benchmarks the QIPRNG package against other random number generators in R. It provides detailed performance comparisons across different sample sizes, configurations, and distributions.

Usage



benchmark_qiprng(

  n_values = c(10, 100, 1000, 10000, 100000, 1000000),

  generators = list(

    "qiprng" = function(n) generatePRNG(n),

    "base_r" = function(n) runif(n),

    "dqrng" = function(n) dqrunif(n)

  ),

  distributions = c("uniform", "normal", "exponential"),

  repetitions = 10,

  configs = list(

    "default" = list(),

    "crypto" = list(use_crypto_mixing = TRUE),

    "high_precision" = list(mpfr_precision = 128)

  ),

  export_data = FALSE,

  file = "qiprng_benchmark.rds"

)

Parameters

n_values
any
Vector of sample sizes to benchmark
generators
any
List of generator functions to compare; each function should take n as input and return n random numbers
distributions
any
Character vector of distributions to test (“uniform”, “normal”, “exponential”)
repetitions
any
Number of repetitions for each benchmark
configs
any
List of QIPRNG configurations to test
export_data
any
Whether to export raw benchmark data
file
any
Path to save results if export_data is TRUE

Returns

  • A list containing benchmark results and plots:
  • results: Raw benchmark data from microbenchmark
  • plots: A list of ggplot objects visualizing the results

Examples