Skip to main content
QUICK REVIEW

[Paper Review] Random Numbers in Scientific Computing: An Introduction

Helmut G. Katzgraber|arXiv (Cornell University)|May 22, 2010
Scientific Research and DiscoveriesPhysics and Astronomy7 references6 citations
TL;DR

This tutorial provides a comprehensive overview of random number generation in scientific computing, comparing true random number generators (TRNGs) and pseudo random number generators (PRNGs), with emphasis on modern, fast, and high-quality PRNGs like the Mersenne Twister. It outlines testing methods for RNG quality, implementation in scientific libraries (e.g., Boost, GSL), and best practices for parallel computing and seeding, advocating for reproducibility and trust in established generators over custom implementations.

ABSTRACT

Random numbers play a crucial role in science and industry. Many numerical methods require the use of random numbers, in particular the Monte Carlo method. Therefore it is of paramount importance to have efficient random number generators. The differences, advantages and disadvantages of true and pseudo random number generators are discussed with an emphasis on the intrinsic details of modern and fast pseudo random number generators. Furthermore, standard tests to verify the quality of the random numbers produced by a given generator are outlined. Finally, standard scientific libraries with built-in generators are presented, as well as different approaches to generate nonuniform random numbers. Potential problems that one might encounter when using large parallel machines are discussed.

Motivation & Objective

  • To provide researchers with a clear understanding of the differences, advantages, and limitations of true and pseudo random number generators in scientific applications.
  • To identify high-quality, fast PRNGs that pass standard statistical benchmarks and are suitable for large-scale simulations.
  • To present practical methods for generating non-uniform random variates and ensuring reproducibility in scientific computing.
  • To address challenges in parallel computing environments, particularly seed management and avoiding overlap in random number streams.
  • To guide researchers in selecting, testing, and correctly using random number generators to ensure result reproducibility and data provenance.

Proposed method

  • Classifying RNGs into TRNGs (based on physical processes like radioactive decay or quantum optics) and PRNGs (deterministic algorithms with long periods and good statistical properties).
  • Evaluating RNG quality using standard statistical tests such as the Diehard tests and NIST SP 800-22, focusing on uniformity, independence, and lack of correlation.
  • Implementing non-uniform random variates using transformation methods (e.g., inverse CDF) and library tools like Boost’s variate_generator and GSL’s distribution engines.
  • Applying block splitting and leapfrogging techniques to distribute a single random number stream across multiple parallel processes to avoid overlap and maintain quality.
  • Using system time and process ID (PID) to generate unique, non-colliding seeds in multi-core and cluster environments to ensure reproducibility.
  • Recommending the use of well-vetted, standardized PRNGs (e.g., Mersenne Twister) over custom implementations to avoid subtle flaws and ensure reliability.

Experimental results

Research questions

  • RQ1What are the key differences between true random number generators (TRNGs) and pseudo random number generators (PRNGs), and in which scientific contexts are each most appropriate?
  • RQ2Which modern PRNGs offer the best balance of speed, period length, and statistical quality, and how can they be validated?
  • RQ3How can non-uniform random variates be efficiently and accurately generated from uniform random number streams in scientific simulations?
  • RQ4What are the main challenges in using PRNGs in large-scale parallel and distributed computing environments, and how can they be mitigated?
  • RQ5What best practices should researchers follow to ensure reproducibility and data provenance in simulations relying on random number generation?

Key findings

  • The Mersenne Twister (MT19937) is a widely used, high-quality PRNG with a period of 2^19937 - 1, passing most standard statistical tests and suitable for most scientific simulations.
  • TRNGs based on quantum processes (e.g., idQuantique) or physical noise sources (e.g., thermal, atmospheric) produce truly random numbers but are too slow for large-scale simulations.
  • Using the same PRNG with different seeds per process in parallel simulations can lead to overlapping streams if the period is insufficient, necessitating structured methods like block splitting or leapfrogging.
  • Combining system time and process ID (PID) in a deterministic formula yields unique seeds with an estimated collision rate of one in 10^4 job submissions, improving reproducibility on multi-core nodes.
  • The use of trusted, well-documented libraries such as Boost and GSL significantly reduces the risk of implementation errors and ensures consistent, high-quality random number generation.
  • Reproducibility in scientific computing requires storing both the PRNG type and the seed used, enabling others to exactly reproduce simulation results.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.