CppCon 2016: Walter E. Brown “What C++ Programmers Need to Know about Header <random>'

preview_player
Показать описание


The generation of pseudo-random numbers has been an important computing application ever since the pioneering work of John von Neumann and others during the World War II era. It remains an important application for gaming, statistical sampling, and simulation, to name but a few areas of its continuing utility.

Obtaining a random number (technically, a variate) is widely believed to be a simple task. Alas, it usually isn't, and programmers often have little or no training to help them make important decisions that can have subtle effects on the correctness and reliability of their programs' results.

In this talk by the principal author of the C++ -random- facility, we will describe the header's conceptual underpinnings, demonstrate its most common correct usage pattern, exhibit and explain what's wrong with its most common usage anti-pattern, and discuss the merits of a number of possible toolkits based on the header's facilities.

Walter E. Brown
With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a C++ programmer for over thirty-five years, joining the C++ standards effort in 2000. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend, common_type, gcd, and void_t, as well as headers < random > and < ratio >. He has also significantly impacted such core language features as alias templates, contextual conversions, variable templates, and static_assert. He conceived and served as project editor for the International Standard on Special Mathematical Functions in C++, now part of the forthcoming C++17.

When not playing with his grandchildren, Dr. Brown is an Emeritus participant in the C++ standards process, with several more core and library proposals under consideration.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

I really appreciate that Walter Brown takes his craft seriously. He seems like a pleasantly professional guy.

optimusvladx
Автор

Walter Brown has great presentation skills. Among my favorites. There are many good presenters, but I think that him and Andrei Alexandrescu stand apart for different reasons. They are really good at exposing. Walter Brown's metaprogramming Compendium is impressively well explained too.

germandiagogomez
Автор

The random-iterator-stuff is especially interesting!

dasnacl
Автор

Almost everyone initializes their engine by a single integer from random generator. Mersenne twister has huge state and almost everybody initializes it with single integer, that gives you only 232 different sequences. Correct usage is to gather enough "true" random bits into vector or array and pass this data through seed_seq like interface into mersenne twister constructor.

MarekKnapek
Автор

CppCon video without subtitles?
Wow
Truly random

NoNameAtAll
Автор

This is perfect. Exactly what I was searching for.

pablo_brianese
Автор

22:52 a clock, watching this because I don't need sleep, i need answers.

crusaderanimation
Автор

very clever man. One from not so many talks which I enjoyed.

rubykorubyko
Автор

It would be interesting to see how the interfaces of random could be adapted to make proper use of quasi random sampling (low discrepancy sequences). I'll like an interface where I could use either.

DefWorlds
Автор

I'm guilty of "rolling my own" and getting it wrong - with RNG as well as other things. When nobody is relying on your bad code for anything important, it's OK ; you learn from your mistakes and move on. It's pretty nice to do less work and get a much better result.

For RNG I've been using Melissa O'Neil's "randutils" header, which builds on the excellent interfaces & facilities provided in <random> to give an interface that's more convenient for most uses. One highlight is good seeding by default using a variety of local sources of entropy. std::random_device seems like it can help with seeding but it can't be relied on for that (not portably at least). I've heard that Melissa's work (or something much like it) may make it into the language spec.

vonkruel
Автор

At 1:00:00. Lambda functions need ;'s and [] replaced by [=]

pablo_brianese