~/talk

I Just Wanted a Random Integer!

Talkat CppCon 2016 · 2016-09-18..09-23· [testing]
links:none on file
slides:none on file

Using rand()+modulo fails unit tests: low bits bias misses edge cases, and random_device is hardware dependent, can block or throw. Seeding mt19937 with random_device then using std::uniform_int_distribution gives repeatable tests; mt19937 generates 1e9 ints in ~3.6s vs random_device ~44s, but initializing mt19937 a million times costs ~15s. PCG implementations are ~2.5× faster and much smaller. Integer distributions are cheap to construct; always log seeds and benchmark performance.

AI-written summary · about

  1. 0:00Introduction and DNA context
  2. 3:12Bad random number habits
  3. 10:00What is entropy?
  4. 12:37Random device explained
  5. 18:44Generators and Mersenne Twister
  6. 22:14Guidelines from STL's talk
  7. 26:50History of Mersenne and PCG
  8. 33:14PCG random number generator
  9. 36:08Uniform distribution in loops
  10. 43:37Engineering judgment over rules
  11. 47:11Conclusion and benchmarking advice
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.