
Modern C++ Programming Cookbook
By :

In the previous recipe, we have looked at the pseudo-random number library with its components and how it can be used to produce numbers in different statistical distributions. One important factor that was overlooked in that recipe is the proper initialization of the pseudo-random number generators. In this recipe, you will learn how to initialize a generator in order to produce the best sequence of pseudo-random numbers.
You should read the previous recipe, Generating pseudo-random numbers, to get an overview of what the pseudo-random number library offers.
To properly initialize a pseudo-random number generator to produce the best sequence of pseudo-random numbers, perform the following steps:
std::random_device
to produce random numbers to be used as seeding values:std::random_device rd;
std::array<int,...