#include <algorithm> iterator generate_n( iterator result, size_t num, Generator g );
The generate_n() function runs the Generator function object g num times, saving the result of each execution in result, (result+1), etc.