O'Reilly logo

C++17 STL Cookbook by Jacek Galowicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

We will implement a procedure that prints a nice illustrating histogram of the numbers a random generator produces. Then, we will run all STL random number generator engines through this procedure and learn from the results. This program contains many repetitive lines, so it might be advantageous to just copy the source code from the code repository accompanying this book on the Internet instead of typing all the repetitive code manually.

  1. At first, we include all the necessary headers and then declare that we use the std namespace by default:
      #include <iostream>      #include <string>      #include <vector>      #include <random>      #include <iomanip>      #include <limits>      #include <cstdlib>      #include <algorithm>            using namespace std;
  1. Then ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required