CppCon 2016: Cheinan Marks “I Just Wanted a Random Integer!"





The interactive transcript could not be loaded.


Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on Oct 5, 2016


Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2016

I just wanted to generate a random integer between 1 and 100 for my unit tests.

An hour later I was down the rabbit hole of the C++ <random> header wondering why it was so complicated, weren't rand() and modulo good enough and was <random> overkill, genius or both?

Several hours later I had watched STLs 2013 Going Native talk on < random> (go watch it!), read some blogs and had even more questions: does the mt19937 generator go on the heap? Just how cheap are uniform distributions to construct? Were there even better generators out there and were they easier to use? Oh and what is entropy? How do you put it in a pool and how can it be exhausted?

The story took a few unexpected twists and turns, but in the end I got my random integers, and answers to almost all my questions which I will share. Whether <random> is genius or overkill though, you will have to decide for yourself.

Cheinan Marks
Spiral Genetics
As an engineer with a chemical engineering background, Cheinan is interested in practical code and wants to take the latest advances both in science and programming and use them in real life working code along with applying engineering principles to software development. Cheinan is a senior developer at Spiral Genetics, Inc. in Seattle.

Videos Filmed & Edited by Bash Films: http://www.BashFilms.com


to add this to Watch Later

Add to

Loading playlists...