Fast, High-Quality Pseudo-Random Numbers for Non-Cryptographers in C++
summary
Benchmarks compare std::mt19937 against modern alternatives and find zoshiro128+ and PCG produce similar perceptual audio results but run faster and with steadier timing. Code uses C++ <random> distributions, generate_canonical, sampling at 48 000 Hz and buffers 512/8192, plus a simple seed pod atomic seeding scheme. Demo builds white noise vinyl dust and a reverb; sequential seeding yields about 29 collision-free scratches for mt19937 versus 26 for zoshiro128+ and PCG shows similarly low collision counts, and full-plugin end-to-end timing is statistically indistinguishable.
AI-written summary · about
chapters (25)
- 0:00Welcome and introduction to the talk
- 1:04Speaker background and context of use cases
- 2:29Digital audio basics and sampling fundamentals
- 5:14Reverb product and random number needs
- 7:19Exploring non-standard library generators
- 9:02Defining quality for random number generation
- 12:12Pseudo-random versus truly random numbers
- 15:00Use cases for random numbers in software
- 16:52Problems with std::rand and basic seeding
- 19:19Generator and distribution design considerations
- 21:06Seeding strategies and challenges
- 24:13Practical approaches to seeding generators
- 27:20Overview of external random number generators
- 30:49Audio demos and real-world examples
- 34:15Benchmarking different algorithms
- 36:21Quality tests with vinyl scratches and noise
- 41:18Evaluating generator performance in practice
- 42:00Portability and distribution concerns
- 43:24Performance impact of distributions
- 46:37End-to-end benchmarking results
- 48:45Final recommendations and conclusions
- 49:05Q&A: Compute percentage for PRNGs
- 50:53Q&A: Generator sharing versus per-use case
- 53:21Q&A: Parallel generation with SIMD and GPUs
- 54:23Q&A: Jitter and timing variance in generators
related talks
42mSurprise yourself with Property Based Testing
01h 03mExploration of Strongly-typed Units in C++: A Case Study from Digital Audio
10mTango: Precise Performance Measurement through Direct Comparison
01h 05mThe Speed Game: Automated Trading Systems in C++
01h 01mWant fast C++? Know your hardware!
50mHigh Performance Network Programming in Rust
37mRhythm 'n Rust: Building a Synthesizer from A to Z in Rust
01h 22mCostless Software Abstractions for Parallel Architectures
