"Random number engines generate pseudo-random numbers using seed data as entropy source."
"mersenne_twister_engine is a random number engine based on Mersenne Twister algorithm.
It produces high quality unsigned integer random numbers" static std::mt19937 rng( std::time(nullptr) ) ; // our random number engine (seeded with the current time)
"A random number distribution post-processes the output of an random number engine in such a way that resulting output is distributed according to a defined statistical probability density function."
"std::uniform_int_distribution produces random integer values uniformly distributed on the closed interval [a, b]"
1 2
// our random number distribution (to generate a random integer in the range zero to NUM_STRINGS-1:
static std::uniform_int_distribution<std::size_t> distrib( 0, NUM_STRINGS-1 ) ;
1 2
// generate a random number in the range zero to NUM_STRINGS-1 and return the string at that position
return strings[ distrib(rng) ] ;