Graph
Random Number Generator

🎲Random Number Generator

NEW

Also known as: RNG

A mechanism that outputs random or pseudorandom values for sampling, simulation, security protocols, and algorithms.

DESCRIPTION

Random number generators (RNGs) produce values with no discernible pattern, underpinning simulations, statistical sampling, randomized algorithms, and cryptographic operations. They come in two major forms: true RNGs (TRNGs) that derive randomness from physical phenomena, and pseudorandom number generators (PRNGs) that deterministically expand a short seed into long sequences. In security contexts, generators must be resistant to prediction and bias, typically achieved by cryptographically secure PRNGs fed by high-quality entropy sources. Statistical test suites (e.g., NIST SP 800-22) evaluate output properties, while standards like NIST SP 800-90 series define design and validation requirements. Proper seeding, reseeding, and entropy estimation are critical to avoid catastrophic failures. RNG quality directly affects reproducibility in science and unpredictability in cryptography.

ALTERNATIVE DEFINITIONS

Wikipedia

A random number generator (RNG) is a device that generates a sequence of numbers or symbols that cannot be reasonably predicted better than by a random chance.

Highlights unpredictability and treats both devices and algorithms as RNGs.

Source

NIST CSRC Glossary

Random Number Generator (RNG): A process used to produce a sequence of numbers that lacks any pattern, i.e., appears random.

Concise glossary framing randomness as lack of pattern from a standard body.

Source

IETF RFC 4086

Random numbers are needed for purposes such as key generation, nonces, and initialization vectors; the quality of the random numbers used directly affects the security of these mechanisms.

Emphasizes security-critical use cases and the impact of quality.

Source

Python Documentation

This module implements pseudo-random number generators for various distributions.

Clarifies that common programming RNGs are pseudorandom and distribution-aware.

Source

Entropy Source Seed Deterministic Random Bit Generator Randomness Testing NIST SP 800-90B NIST SP 800-22 Cryptographically Secure Pseudorandom Number Generator Uniform Distribution

COMPETING TERMS

True Random Number Generator Pseudorandom Number Generator

RELATIONS

KNOWLEDGE AREAS

Mathematics Data Security Data Science Testing & Validation Software Engineering

TARGET AUDIENCE

Cybersecurity Engineer Security Architect Software Developer Data Scientist AI Engineer Data Engineer Chief Information Security Officer

EXTERNAL SOURCES

  • Wikipedia - Random number generator
  • NIST - Entropy sources requirements and validation
  • NIST - Randomness test suites and resources
  • IETF - Randomness requirements for security
  • OpenSSL - CSPRNG interface and guidance
  • NumPy - Scientific RNG APIs in Python

TOP QUESTIONS

Why is a Random Number Generator critical in cryptography?

Security hinges on unpredictability. Weak RNGs expose keys, nonces, and tokens to prediction attacks, undermining encryption, signatures, and protocols. Good entropy and CSPRNGs are non-negotiable.

Category: Risk

What is the difference between a Random Number Generator and a Pseudorandom Number Generator?

An RNG can be either true (physical) or pseudorandom (algorithmic). PRNGs deterministically expand seeds, whereas true RNGs rely on physical entropy sources.

Category: Misunderstanding

How do you seed a Random Number Generator correctly?

Use system-provided cryptographic entropy (e.g., /dev/urandom, CSPRNG APIs) rather than timestamps. Periodically reseed for long-running systems.

Category: Requirements

What tests can validate a Random Number Generator?

Standard suites include NIST SP 800-22, Dieharder, and TestU01. Passing tests is necessary but not sufficient for cryptographic security.

Category: Testing

When should you use a cryptographically secure Random Number Generator?

Always for secrets, tokens, keys, nonces, and any value whose predictability creates security risk. Use vetted libraries instead of custom RNGs.

Category: BestPractice

What are common mistakes with Random Number Generators?

Using predictable seeds, reusing nonces, relying on non-crypto PRNGs for security, and disabling entropy sources in production are frequent errors.

Category: Mistakes

How does entropy influence a Random Number Generator?

Entropy measures unpredictability. Insufficient entropy reduces randomness quality, increasing predictability and attack surface.

Category: Concept

Is the system clock a safe seed for a Random Number Generator?

No. Timestamps are predictable, especially in servers. Use OS cryptographic APIs that mix multiple entropy sources.

Category: Risk

What is currently a hot topic around Random Number Generators?

Post-quantum-safe RNG constructions, robust entropy harvesting in virtualized/cloud environments, and formal verification of DRBG implementations.

Category: Topic

How do Random Number Generators impact reproducible research?

PRNGs with fixed seeds enable reproducible experiments. Document generator type, version, and seed to ensure replicability.

Category: Reproducibility