Concept Architecture
Pseudo-Random Number: Concept Architecture
Orientation and learning roadmap
The page follows one generated value from an initialized algorithm into a health simulation. It then separates the role of the seed from the event probability, illustrates repeatable draws, and explains how stream management and validation affect a model comparison.
From a seed to a sequence
A computer algorithm begins from an internal state, often initialized through a seed, and applies a specified update rule to generate successive values. Given the same implementation, initial state, and sequence of calls, it produces the same outputs again. Those outputs can mimic selected statistical properties of random draws even though the underlying process is deterministic.
An abstract generator can be written as:
where is the generator state, advances it, and maps state to an output on a defined scale. The algorithm, seed or full initial state, stream identifier, and number and order of draws all matter for reproducing a sequence. The output number is not itself a probability estimate; the model uses it with a probability rule to select an outcome.
Many simulation routines provide values treated as approximately uniform on the interval . A uniform draw is then transformed or compared with a threshold to simulate a Bernoulli event, a categorical transition, a waiting time, or another random variable. The suitability of that use depends on the generator's statistical properties and implementation, not on whether a short excerpt of the sequence looks irregular to a reader.
A worked event draw
Suppose a model assigns a 0.20 probability of an adverse event for a particular patient in one cycle. If is a suitably generated uniform draw, the model can record an event when . Under the modeling assumptions, the event probability is 0.20 across repeated hypothetical draws; one patient's outcome remains either event or no event.
For illustration, draws of 0.08, 0.73, 0.19, and 0.44 produce outcomes 1, 0, 1, and 0. Two events in four draws do not change the specified 0.20 probability to 0.50; a tiny realized sample can differ substantially from its generating probability. These four numbers are teaching inputs, not evidence of the output of a named generator.
A model may also draw a value from a distribution for an uncertain parameter, then use separate draws to simulate individual events conditional on that parameter. The first represents parameter uncertainty; the second represents individual stochastic variation. Keeping the two levels distinct prevents a simulation result from being misinterpreted as a parameter estimate.
Reproducibility is more than recording a seed
A fixed seed can help reproduce a run, but it does not make its results statistically reliable. Changing the algorithm, software version, parallel scheduling, or order of random-number calls can change the output even when a seed number is reused. A reproducible analysis should record the generator and software environment, initialization method, stream design, model version, and analysis code alongside the seed or state.
A single run may also contain simulation noise. For a decision comparison, check whether incremental outcomes remain stable across sufficiently many individuals and independent replications or seeds. State a prespecified precision or convergence target appropriate to the decision rather than assuming that a repeatable result is an accurate expectation.
| Item to record | Why it matters |
|---|---|
| Algorithm and implementation | Different generators can turn the same seed into different streams. |
| Seed or full initial state | The starting point determines the subsequent deterministic sequence. |
| Stream assignment | Separate event mechanisms and parallel workers need a documented allocation of draws. |
| Draw order and code version | A new model branch may consume draws in another order and alter downstream outputs. |
| Replications and precision check | A fixed sequence does not remove Monte Carlo error from a finite simulation. |
Compare strategies with well-managed streams
An individual-level economic model may simulate the same target population under two strategies. If unrelated random sequences generate patient characteristics or background events in each strategy, some variation in their difference comes from the draw assignment rather than the strategies. Common random numbers can align corresponding sources of variation and reduce the Monte Carlo variance of an incremental estimate when implemented correctly.
This requires careful stream design: draw for the same underlying event from the corresponding stream in each strategy, while preserving separate streams for distinct event types. Simply resetting one global seed before each arm can lose alignment when the arms consume different numbers of draws. Conversely, streams intended to be independent must be created by a method supported by the generator rather than by assuming adjacent seed integers always guarantee independence.
The variance identity explains the potential benefit of positively correlated outcomes and generated with common draws:
If the common draws produce a positive covariance while preserving the correct marginal simulations, the variance of the difference can fall. This technique improves simulation precision for a comparison; it does not eliminate uncertainty in the clinical evidence or automatically favor either strategy.
What to validate before relying on draws
A generator's output should be assessed for the intended use, including its period, distributional behavior, stream separation, and any software-specific guarantees. Passing a few statistical tests is not proof of perfect randomness or model validity. A simple demonstration generator can be useful for teaching but should not be assumed suitable for a large or parallel decision simulation.
- Match the generator to the task. Document the algorithm and use a tested implementation appropriate to the simulation, rather than an ad hoc recurrence.
- Check transformations. Confirm that draws map to the intended event probabilities or distributions with correct interval boundaries and units.
- Design streams deliberately. Separate mechanisms and parallel runs, and document when corresponding strategies share random inputs.
- Assess simulation error. Repeat runs or increase simulation size to establish that the decision-relevant results have adequate numerical precision.
- Preserve provenance. Record software, version, seed or state, stream mapping, and model code needed to reproduce the outputs.
Simulation-grade pseudorandom numbers and cryptographically secure generators serve different purposes. A health economic model needs sound statistical and reproducibility properties for its simulation; a security-sensitive application may additionally require resistance to prediction. The fact that an algorithm is deterministic does not by itself tell the analyst whether it is fit for either task.
Evidence used for this explanation
NIST describes the deterministic generation and seed relationship, while model-specific guidance explains why streams and repeated runs matter in health economic simulation. The sources support these methodological distinctions; they do not certify an unnamed generator used in a particular model.
- NIST Computer Security Resource Center. Pseudorandom number generator glossary entry.
- NIST Dictionary of Algorithms and Data Structures. Pseudo-random number generator.
- Karnon J et al. Modeling using discrete event simulation: ISPOR-SMDM Good Research Practices Task Force 4. Value in Health (2012).
- Using Common Random Numbers in Health Care Cost-Effectiveness Simulation Modeling. Medical Decision Making (2013).
Related Concepts (1)
Library
Tools & Resources
1
hesim — Health Economic Simulation Modeling and Decision Analysis (R package) — Devin Incerti & Jeroen P. Jansen, R package ed., 2024 (CRAN)
A modular, computationally efficient R package for building and analysing health economic simulation models — cohort state-transition, partitioned survival, and individual-level continuous-time models — with fast individual-patient simulation and PSA via C++.
Software (R package)View source →
Frequently Asked Questions (6)
What is a pseudo-random number?
A number generated by a deterministic algorithm that approximates the statistical properties of true randomness, used because genuine randomness is hard to compute.
Source: Press et al. 2007
How does a pseudo-random number differ from a truly random one?
A truly random number has no pattern and cannot be predicted or reproduced, whereas a pseudo-random number is produced by a fixed rule that only imitates randomness. Given the same starting point, the rule generates exactly the same sequence every time, so the numbers are not genuinely unpredictable. They are used because they pass statistical tests for randomness closely enough while remaining fast to compute and, importantly, reproducible. That reproducibility is a feature rather than a flaw for modelling. Press and colleagues (2007) explain the distinction.
Source: Press et al. 2007
Why are pseudo-random numbers used instead of true random numbers?
Pseudo-random numbers are used because true randomness is difficult and slow to obtain in a computer, whereas a deterministic algorithm can generate numbers quickly that behave, for statistical purposes, like random ones. The sequence, though reproducible from its algorithm, passes tests of randomness well enough for simulation and sampling. This makes pseudo-random numbers practical for the large volumes of random draws that Monte Carlo methods require, providing apparent randomness efficiently and, usefully, reproducibly.
Source: Press et al. 2007
What properties should pseudo-random numbers have?
Good pseudo-random numbers should be uniformly distributed, statistically independent, and free of detectable patterns, passing tests of randomness, and the generator should have a very long period before the sequence repeats. Poor generators can show correlations or short periods that bias results. Because simulations may draw enormous quantities of numbers, the quality of the generator matters, so well-tested algorithms are used to ensure the pseudo-random numbers adequately mimic true randomness for the computation.
Source: Press et al. 2007
How are pseudo-random numbers used in Monte Carlo simulation?
In Monte Carlo simulation, pseudo-random numbers provide the random draws needed to sample values from probability distributions, so that inputs can be varied across many iterations and the distribution of outputs examined. Each sampled value is derived from pseudo-random numbers transformed to follow the required distribution. Because such simulations, including probabilistic sensitivity analysis, may require millions of draws, pseudo-random numbers supply the randomness efficiently, making the method practical while their reproducibility allows results to be repeated exactly.
Source: Metropolis & Ulam 1949
What are the limitations of pseudo-random numbers?
Because pseudo-random numbers are produced deterministically, they are not truly random and repeat after their period, and poor generators can contain hidden correlations or patterns that bias simulations relying on independence. A generator with too short a period or subtle regularities can distort results, particularly in large simulations. These limitations mean the generator must be well tested and suited to the scale of use, so that the pseudo-random numbers behave sufficiently like true randomness for the analysis to be valid.
Source: Press et al. 2007
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 25 Sep 2026
Content version: 1.0.0
Canonical Identity
- Term code
- HE-EM-MS-007
Stable URI · Machine-readable · Resolvable · CC BY 4.0
