“What C++ Programmers Need to Know about Header <random>"
summary
Explains why the <random> header separates engine vs distribution (use an engine as a bits source and let a distribution produce the shaped variates), shows the correct pattern (instantiate an engine and call a distribution) and demonstrates the common modulo-bias anti-pattern (remainder-of-engine produces biased dice), warns that default_random_engine is vendor-chosen while nine other engines are bit-for-bit portable, lists ~20 distributions, notes Mersenne Twister’s large state (~600× bigger) and covers random_device, generate_canonical, seed issues, sample/shuffle, and extensional engines like PCG and Random123.
AI-written summary · about
chapters (11)
- 0:00Introduction and thanks
- 1:50Background on randomness
- 14:25Engines vs distributions
- 24:29Preconfigured engines
- 31:38Random device and entropy
- 35:57Distribution families
- 43:08Anti-pattern: biased die roll
- 50:36Correct usage with distributions
- 55:40Resource management tips
- 1:01:42Future directions and resources
- 1:07:27Q&A and closing
related talks
35mGuide to Random Number Generation in C++
50mLeveraging Modern C++ in Quantitative Finance
01h 06mModern C and What We Can Learn From It
29mC++ Cryptozoology - A Compendium of Cryptic Characters
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
15mC++ WAT
01h 30mTaming C++23 - The Things About C++23 You Do Not Know
52mC++ Puzzlers
