principles_and_practice_using_cpp Key points chapter 5 generate_rand_nums() function, use C++11 random library. to find more detail, the following links can be helpful: Actually, this is the example that using in my code. Generate random numbers using C++11 random library Cpp reference -- Pseudo-random number generation Cpp reference -- srand chapter 9 mentioned that you can also use struct for a data structure here's a link to discuss the diff between class and struct: Function for C++ struct you'd better use scoped enumeration instead of using plain enumeration, which means: enum class is better than enum declaration code like below, static will let dd created only once: const Date& default_date() { static Date dd{Year{2001}, Month::jan, 1}; return dd; } issues CLion gets wrong CMAKE_OSX_SYSROOT value ofstream doesn't flush